diff --git a/CodeVersion/Makefile b/CodeVersion/Makefile new file mode 100644 index 00000000..59d05314 --- /dev/null +++ b/CodeVersion/Makefile @@ -0,0 +1,157 @@ +# Makefile for CodeVersion + +# BEGIN_ICS_COPYRIGHT8 **************************************** +# +# Copyright (c) 2017, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# END_ICS_COPYRIGHT8 **************************************** + +# Include Make Control Settings +include $(TL_DIR)/$(PROJ_FILE_DIR)/Makesettings.project + +#=============================================================================# +# Definitions: +#-----------------------------------------------------------------------------# + +# Name of SubProjects +DS_SUBPROJECTS = +# name of executable or downloadable image +EXECUTABLE = # CodeVersion$(EXE_SUFFIX) +# list of sub directories to build +DIRS = +# C files (.c) +CFILES = \ + code_version.c \ + # Add more c files here +# C++ files (.cpp) +CCFILES = \ + # Add more cpp files here +# lex files (.lex) +LFILES = \ + # Add more lex files here +# archive library files (basename, $ARFILES will add MOD_LIB_DIR/prefix and suffix) +LIBFILES = +# Windows Resource Files (.rc) +RSCFILES = +# Windows IDL File (.idl) +IDLFILE = +# Windows Linker Module Definitions (.def) file for dll's +DEFFILE = +# targets to build during INCLUDES phase (add public includes here) +INCLUDE_TARGETS = \ + code_version.h \ + # Add more h hpp files here +# Non-compiled files +MISC_FILES = +# all source files +SOURCES = $(CFILES) $(CCFILES) $(LFILES) $(RSCFILES) $(IDLFILE) +# Source files to include in DSP File +DSP_SOURCES = $(INCLUDE_TARGETS) $(SOURCES) $(MISC_FILES) \ + $(RSCFILES) $(DEFFILE) $(MAKEFILE) +# all object files +OBJECTS = $(CFILES:.c=$(OBJ_SUFFIX)) $(CCFILES:.cpp=$(OBJ_SUFFIX)) \ + $(LFILES:.lex=$(OBJ_SUFFIX)) +RSCOBJECTS = $(RSCFILES:.rc=$(RES_SUFFIX)) +# targets to build during LIBS phase +LIB_TARGETS_IMPLIB = +LIB_TARGETS_ARLIB = $(LIB_PREFIX)CodeVersion$(ARLIB_SUFFIX) +LIB_TARGETS_EXP = $(LIB_TARGETS_IMPLIB:$(ARLIB_SUFFIX)=$(EXP_SUFFIX)) +LIB_TARGETS_MISC = +# targets to build during CMDS phase +SHLIB_VERSION = +CMD_TARGETS_SHLIB = +CMD_TARGETS_EXE = $(EXECUTABLE) +CMD_TARGETS_MISC = +CMD_TARGETS_DRIVER = +CMD_TARGETS_KEXT = +# files to remove during clean phase +CLEAN_TARGETS_MISC = +CLEAN_TARGETS = $(OBJECTS) $(RSCOBJECTS) $(IDL_TARGETS) $(CLEAN_TARGETS_MISC) +# other files to remove during clobber phase +CLOBBER_TARGETS_MISC= +# sub-directory to install to within bin +BIN_SUBDIR = +# sub-directory to install to within include +INCLUDE_SUBDIR = + +# Additional Settings +#CLOCALDEBUG = User defined C debugging compilation flags [Empty] +#CCLOCALDEBUG = User defined C++ debugging compilation flags [Empty] +CLOCAL = $(CPIE) +#CCLOCAL = User defined C++ flags for compiling [Empty] +#BSCLOCAL = User flags for Browse File Builder [Empty] +#DEPENDLOCAL = user defined makedepend flags [Empty] +#LINTLOCAL = User defined lint flags [Empty] +#LOCAL_INCLUDE_DIRS = User include directories to search for C/C++ headers [Empty] +#LDLOCAL = User defined C flags for linking [Empty] +#IMPLIBLOCAL = User flags for Object Lirary Manager [Empty] +#MIDLLOCAL = User flags for IDL compiler [Empty] +#RSCLOCAL = User flags for resource compiler [Empty] +#LOCALDEPLIBS = User libraries to include in dependencies [Empty] +#LOCALLIBS = User libraries to use when linking [Empty] +# (in addition to LOCALDEPLIBS) +#LOCAL_LIB_DIRS = User library directories for libpaths [Empty] + +LOCALDEPLIBS = + +# Include Make Rules definitions and rules +include $(TL_DIR)/$(PROJ_FILE_DIR)/Makerules.project + +#=============================================================================# +# Overrides: +#-----------------------------------------------------------------------------# +#CCOPT = # C++ optimization flags, default lets build config decide +#COPT = # C optimization flags, default lets build config decide +#SUBSYSTEM = Subsystem to build for (none, console or windows) [none] +# (Windows Only) +#USEMFC = How Windows MFC should be used (none, static, shared, no_mfc) [none] +# (Windows Only) +#=============================================================================# + +#=============================================================================# +# Rules: +#-----------------------------------------------------------------------------# +# process Sub-directories +include $(TL_DIR)/Makerules/Maketargets.toplevel + +# build cmds and libs +include $(TL_DIR)/Makerules/Maketargets.build + +# install for includes, libs and cmds phases +include $(TL_DIR)/Makerules/Maketargets.install + +# install for stage phase +#include $(TL_DIR)/Makerules/Maketargets.stage +STAGE:: + +# Unit test execution +#include $(TL_DIR)/Makerules/Maketargets.runtest + +#=============================================================================# + +#=============================================================================# +# DO NOT DELETE THIS LINE -- make depend depends on it. +#=============================================================================# diff --git a/CodeVersion/README b/CodeVersion/README new file mode 100644 index 00000000..cf0c2b00 --- /dev/null +++ b/CodeVersion/README @@ -0,0 +1 @@ +library which can return version and brand as set by patch_version diff --git a/CodeVersion/code_version.c b/CodeVersion/code_version.c new file mode 100644 index 00000000..8f5ea6cd --- /dev/null +++ b/CodeVersion/code_version.c @@ -0,0 +1,128 @@ +/* BEGIN_ICS_COPYRIGHT7 **************************************** + +Copyright (c) 2017, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +** END_ICS_COPYRIGHT7 ****************************************/ +#include +#include +#include + +// The functions here can report version and brand strings which are +// post processed into the executable by invoking patch_version and patch_brand +// during the build +// +// Logs, menus and other interfaces can then use the brand and version strings +// such as follows: +// printf("%s XYZ version %s\n", GetCodeBrand(), GetCodeVersion()); + +// GetCodeVersion +// ----------------- +// GetCodeVersion - retrieve the code version as set by build process. +// The static string contained in this function will be changed +// by patch_version after the build is complete and the string +// has been compiled into the application. This string will be +// modified as necessary to set the version number to match that of +// the build cycle. This routine extracts the version number from +// the string and returns it. +// It accepts no arguments and returns "Unknown" if the string cannot +// be evaluated. +// The version number created can also be extracted by the strings command +// or the internal whatversion tool +// +#define ICS_BUILD_VERSION "THIS_IS_THE_ICS_VERSION_NUMBER:@(#)000.000.000.000B000" +const char* GetCodeVersion(void) +{ + static const char* BuildVersion=ICS_BUILD_VERSION; + static char* version; + static int built=0; + if (!built) + { + // locate start of version string, + // its the first digit in BuildVersion + version = strpbrk(BuildVersion, "0123456789"); + built=1; + } + return(version?version:"Unknown"); +} + +// GetCodeInternalVersion +// ----------------- +// GetCodeInternalVersion - retrieve the code version as set by build process. +// The static string contained in this function will be changed +// by patch_version after the build is complete and the string +// has been compiled into the application. This string will be +// modified as necessary to set the version to match that of +// the build cycle. This routine extracts the version from +// the string and returns it. +// It accepts no arguments and returns "Unknown" if the string cannot +// be evaluated. +// The version number created can also be extracted by the strings command +// or the internal whatversion tool +// +#define ICS_BUILD_INTERNAL_VERSION "THIS_IS_THE_ICS_INTERNAL_VERSION_NUMBER:@(#)000.000.000.000B000I0000" +const char* GetCodeInternalVersion(void) +{ + static const char* BuildVersion=ICS_BUILD_INTERNAL_VERSION; + static char* version; + static int built=0; + if (!built) + { + // locate start of version string, + // its the first digit in BuildVersion + version = strpbrk(BuildVersion, ")") + 1; + built=1; + } + return(version); +} + +// GetCodeBrand +// ----------------- +// GetCodeBrand - retrieve the code brand as set by build process. +// The static string contained in this function will be changed +// by patch_brand after the build is complete and the string +// has been compiled into the application. This string will be +// modified as necessary to set the brand name to match that of +// the build cycle. This routine extracts the brand name from +// the string and returns it. +// It accepts no arguments. +// The brand name created can also be extracted by the strings command +// or the internal whatversion tool +// +#define ICS_BUILD_BRAND "THIS_IS_THE_ICS_BRAND:Intel\000 " +const char* GetCodeBrand(void) +{ + static const char* BuildBrand=ICS_BUILD_BRAND; + static char* brand; + static int built=0; + if (!built) + { + // locate start of brand string, + // its the first : in BuildBrand + brand = strpbrk(BuildBrand, ":")+1; + built=1; + } + return(brand); +} diff --git a/CodeVersion/code_version.h b/CodeVersion/code_version.h new file mode 100644 index 00000000..c04c9399 --- /dev/null +++ b/CodeVersion/code_version.h @@ -0,0 +1,41 @@ +/* BEGIN_ICS_COPYRIGHT7 **************************************** + +Copyright (c) 2017, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +** END_ICS_COPYRIGHT7 ****************************************/ + +/* [ICS VERSION STRING: unknown] */ + +#ifndef CODEVERSION_H +#define CODEVERSION_H + +#include + +extern const char* GetCodeVersion(void); +extern const char* GetCodeInternalVersion(void); +extern const char* GetCodeBrand(void); + +#endif /* CODEVERSION_H */ diff --git a/CommonInstall/DESIGN b/CommonInstall/DESIGN index 54c09008..549c7840 100644 --- a/CommonInstall/DESIGN +++ b/CommonInstall/DESIGN @@ -3,15 +3,15 @@ All the util_*pl files are provide utility functions for use. The comp*pl files are various examples of comp.pl files for assorted products. the main*pl files are the main installer algorithm for assorted packagings, -the one of interest for QLogicIB-IFS is main_openibwrap.pl +the one of interest for IntelOPA-IFS is main_omnipathwrap_delta.pl The comp_qlgc_fm.pl is a good example. It implements a component consisting of two user space rpms with init.d scripts. The main*pl defines which components are part of the packaging and what their -capabilities are. main_openibwrap.pl is a packaging for IntelOPA-IFS and -IntelOPA-Basic. A simpler example is main_qlgc_fm.pl which is a packaging -consisting of just the SM. +capabilities are. main_omnipathwrap_delta.pl is a packaging for IntelOPA-IFS +and IntelOPA-Basic. This main is also used for individual component INSTALLs +along with the corresponding override*pl file. routines in a comp.pl file: config_autostart_X - called to configure autostart of component. Only called if HasStart set in main. diff --git a/CommonInstall/comp_delta.pl b/CommonInstall/comp_delta.pl index b70f0475..e0aae95e 100755 --- a/CommonInstall/comp_delta.pl +++ b/CommonInstall/comp_delta.pl @@ -138,6 +138,25 @@ "openmpi", "gasnet", "openshmem", + "sandiashmem", + "opa_stack_dev", # dev libraries. + "delta_mpisrc", # Source bundle for MPIs. + "mpiRest", # PGI, Intel mpi variants. + "hfi1_uefi", + "delta_debug", # must be last real component +); + +my @delta_components_sles12_sp3 = ( + "opa_stack", # Kernel drivers. + "ibacm", + "intel_hfi", # HFI drivers + "delta_ipoib", # ipoib module. + "mpi_selector", + "mvapich2", + "openmpi", + "gasnet", + "openshmem", + "sandiashmem", "opa_stack_dev", # dev libraries. "delta_mpisrc", # Source bundle for MPIs. "mpiRest", # PGI, Intel mpi variants. @@ -155,6 +174,25 @@ "openmpi", "gasnet", "openshmem", + "sandiashmem", + "opa_stack_dev", # dev libraries. + "delta_mpisrc", # Source bundle for MPIs. + "mpiRest", # PGI, Intel mpi variants. + "hfi1_uefi", + "delta_debug", # must be last real component +); + +my @delta_components_rhel74 = ( + "opa_stack", # Kernel drivers. + "ibacm", + "intel_hfi", # HFI drivers + "delta_ipoib", # ipoib module. + "mpi_selector", + "mvapich2", + "openmpi", + "gasnet", + "openshmem", + "sandiashmem", "opa_stack_dev", # dev libraries. "delta_mpisrc", # Source bundle for MPIs. "mpiRest", # PGI, Intel mpi variants. @@ -227,6 +265,8 @@ UserRpms => [ "libhfi1", "libhfi1-static", "libpsm2", "libpsm2-devel", "libpsm2-compat", + "libfabric", "libfabric-devel", "libfabric-psm", + "libfabric-psm2", "libfabric-verbs", "hfi1-diagtools-sw", "hfidiags", "hfi1-firmware", "hfi1-firmware_debug" ], @@ -240,16 +280,37 @@ }, ); +my %intel_hfi_rhel67_comp_info = ( + 'intel_hfi' => { + KernelRpms => [ ], + UserRpms => [ "libhfi1", "libhfi1-static", + "libpsm2", + "libpsm2-devel", "libpsm2-compat", + "hfi1-diagtools-sw", "hfidiags", + "hfi1-firmware", "hfi1-firmware_debug" + ], + DebugRpms => [ "hfi1_debuginfo", + "hfi1-diagtools-sw-debuginfo", + "libpsm2-debuginfo", "libhfi1-debuginfo" + ], + Drivers => "", + StartupScript => "", + StartupParams => [ ], + }, +); + my %intel_hfi_sles12_sp2_comp_info = ( 'intel_hfi' => { KernelRpms => [ ], UserRpms => [ "libpsm2", "libpsm2-devel", "libpsm2-compat", - "hfi1-diagtools-sw", "hfidiags", - "hfi1-firmware", "hfi1-firmware_debug" + "libfabric", "libfabric-devel", "libfabric-psm", + "libfabric-psm2", "libfabric-verbs", + "hfi1-diagtools-sw", "hfidiags", + "hfi1-firmware", "hfi1-firmware_debug" ], DebugRpms => [ "hfi1-diagtools-sw-debuginfo", - "libpsm2-debuginfo" + "libpsm2-debuginfo" ], Drivers => "", StartupScript => "", @@ -260,13 +321,15 @@ my %intel_hfi_rhel73_comp_info = ( 'intel_hfi' => { KernelRpms => [ ], - UserRpms => [ "libpsm2", + UserRpms => [ "libpsm2", "libpsm2-devel", "libpsm2-compat", - "hfi1-diagtools-sw", "hfidiags", - "hfi1-firmware", "hfi1-firmware_debug" + "libfabric", "libfabric-devel", "libfabric-psm", + "libfabric-psm2", "libfabric-verbs", + "hfi1-diagtools-sw", "hfidiags", + "hfi1-firmware", "hfi1-firmware_debug" ], DebugRpms => [ "hfi1-diagtools-sw-debuginfo", - "libpsm2-debuginfo" + "libpsm2-debuginfo" ], Drivers => "", StartupScript => "", @@ -352,6 +415,17 @@ }, ); +my %sandiashmem_comp_info = ( + 'sandiashmem' => { + KernelRpms => [ ], + UserRpms => [ "sandia-openshmem_gcc_hfi", "sandia-openshmem_gcc_hfi-devel", "sandia-openshmem_gcc_hfi-tests" ], + DebugRpms => [ ], + Drivers => "", # none + StartupScript => "", + StartupParams => [ ], + }, +); + my %opa_stack_dev_comp_info = ( 'opa_stack_dev' => { KernelRpms => [ "" ], @@ -394,8 +468,8 @@ my %opa_stack_dev_rhel72_comp_info = ( 'opa_stack_dev' => { - KernelRpms => [ ], - UserRpms => [ "ifs-kernel-updates-devel", "ibacm-devel" ], + KernelRpms => [ "ifs-kernel-updates-devel" ], + UserRpms => [ "ibacm-devel" ], DebugRpms => [ ], Drivers => "", # none StartupScript => "", @@ -405,8 +479,8 @@ my %opa_stack_dev_sles12_sp2_comp_info = ( 'opa_stack_dev' => { - KernelRpms => [ ], - UserRpms => [ "ifs-kernel-updates-devel" ], + KernelRpms => [ "ifs-kernel-updates-devel" ], + UserRpms => [ ], DebugRpms => [ ], Drivers => "", # none StartupScript => "", @@ -416,8 +490,8 @@ my %opa_stack_dev_rhel73_comp_info = ( 'opa_stack_dev' => { - KernelRpms => [ ], - UserRpms => [ "ifs-kernel-updates-devel" ], + KernelRpms => [ "ifs-kernel-updates-devel" ], + UserRpms => [ ], DebugRpms => [ ], Drivers => "", # none StartupScript => "", @@ -579,6 +653,17 @@ }, ); +my %opa_stack_sles12_sp3_comp_info = ( + 'opa_stack' => { + KernelRpms => [ "ifs-kernel-updates-kmp-default" ], # special case + UserRpms => [ "opa-scripts" ], + DebugRpms => [ ], + Drivers => "", + StartupScript => "opa", + StartupParams => [ "ARPTABLE_TUNING" ], + }, +); + my %opa_stack_rhel73_comp_info = ( 'opa_stack' => { KernelRpms => [ "kmod-ifs-kernel-updates" ], # special case @@ -591,6 +676,18 @@ }, ); +my %opa_stack_rhel74_comp_info = ( + 'opa_stack' => { + KernelRpms => [ "kmod-ifs-kernel-updates" ], # special case + UserRpms => [ "opa-scripts" ], + DebugRpms => [ ], + Drivers => "", + StartupScript => "opa", + StartupParams => [ "ARPTABLE_TUNING" ], + }, +); + + my %delta_comp_info_other = ( %opa_stack_other_comp_info, %ibacm_comp_info, @@ -602,6 +699,7 @@ %openmpi_comp_info, %gasnet_comp_info, %openshmem_comp_info, + %sandiashmem_comp_info, %opa_stack_dev_comp_info, %delta_mpisrc_comp_info, %mpiRest_comp_info, @@ -612,7 +710,7 @@ my %delta_comp_info_rhel67 = ( %opa_stack_rhel67_comp_info, %ibacm_comp_info, - %intel_hfi_comp_info, + %intel_hfi_rhel67_comp_info, %ib_wfr_lite_comp_info, %delta_ipoib_comp_info, %mpi_selector_comp_info, @@ -638,6 +736,7 @@ %openmpi_comp_info, %gasnet_comp_info, %openshmem_comp_info, + %sandiashmem_comp_info, %opa_stack_dev_rhel72_comp_info, %delta_mpisrc_comp_info, %mpiRest_comp_info, @@ -656,6 +755,7 @@ %openmpi_comp_info, %gasnet_comp_info, %openshmem_comp_info, + %sandiashmem_comp_info, %opa_stack_dev_rhel70_comp_info, %delta_mpisrc_comp_info, %mpiRest_comp_info, @@ -673,6 +773,7 @@ %openmpi_comp_info, %gasnet_comp_info, %openshmem_comp_info, + %sandiashmem_comp_info, %opa_stack_dev_comp_info, %delta_mpisrc_comp_info, %mpiRest_comp_info, @@ -690,6 +791,7 @@ %openmpi_comp_info, %gasnet_comp_info, %openshmem_comp_info, + %sandiashmem_comp_info, %opa_stack_dev_sles12_sp2_comp_info, %delta_mpisrc_comp_info, %mpiRest_comp_info, @@ -708,6 +810,45 @@ %openmpi_comp_info, %gasnet_comp_info, %openshmem_comp_info, + %sandiashmem_comp_info, + %opa_stack_dev_rhel73_comp_info, + %delta_mpisrc_comp_info, + %mpiRest_comp_info, + %hfi1_uefi_comp_info, + %delta_debug_comp_info, + %ibacm_rhel73_comp_info, +); + +my %delta_comp_info_sles12_sp3 = ( + %opa_stack_sles12_sp3_comp_info, + %intel_hfi_sles12_sp2_comp_info, + %ib_wfr_lite_comp_info, + %delta_ipoib_comp_info, + %mpi_selector_comp_info, + %mvapich2_comp_info, + %openmpi_comp_info, + %gasnet_comp_info, + %openshmem_comp_info, + %sandiashmem_comp_info, + %opa_stack_dev_sles12_sp2_comp_info, + %delta_mpisrc_comp_info, + %mpiRest_comp_info, + %hfi1_uefi_comp_info, + %delta_debug_comp_info, + %ibacm_sles12_sp2_comp_info, +); + +my %delta_comp_info_rhel74 = ( + %opa_stack_rhel74_comp_info, + %intel_hfi_rhel73_comp_info, + %ib_wfr_lite_comp_info, + %delta_ipoib_comp_info, + %mpi_selector_comp_info, + %mvapich2_comp_info, + %openmpi_comp_info, + %gasnet_comp_info, + %openshmem_comp_info, + %sandiashmem_comp_info, %opa_stack_dev_rhel73_comp_info, %delta_mpisrc_comp_info, %mpiRest_comp_info, @@ -735,7 +876,9 @@ my @delta_kernel_srpms_rhel67 = ( 'ifs-kernel-updates' ); my @delta_kernel_srpms_sles = ( 'compat-rdma' ); my @delta_kernel_srpms_sles12_sp2 = ( 'ifs-kernel-updates-kmp-default' ); +my @delta_kernel_srpms_sles12_sp3 = ( 'ifs-kernel-updates-kmp-default' ); my @delta_kernel_srpms_rhel73 = ( 'kmod-ifs-kernel-updates' ); +my @delta_kernel_srpms_rhel74 = ( 'kmod-ifs-kernel-updates' ); my @delta_kernel_srpms = ( ); # all user space srpms @@ -744,19 +887,19 @@ "opa-scripts", "libibumad", "ibacm", "mpi-selector", "libhfi1", "libpsm2", "hfi1-diagtools-sw", "hfidiags", "hfi1-firmware", "hfi1-firmware_debug", "mvapich2", "openmpi", "gasnet", "openshmem", "openshmem-test-suite", - "shmem-benchmarks", "srptools", "libibmad", "infiniband-diags", "hfi1_uefi" + "shmem-benchmarks", "srptools", "libibmad", "infiniband-diags", "hfi1_uefi", "libfabric", "sandiashmem" ); my @delta_user_srpms_rhel67 = ( "opa-scripts", "libibumad", "ibacm", "mpi-selector", "libhfi1", "libpsm2", "hfi1-diagtools-sw", "hfidiags", "hfi1-firmware", "hfi1-firmware_debug", "mvapich2", "openmpi", "gasnet", "openshmem", "openshmem-test-suite", - "shmem-benchmarks", "srptools", "libibmad", "infiniband-diags", "hfi1_uefi" + "shmem-benchmarks", "srptools", "libibmad", "infiniband-diags", "hfi1_uefi", ); my @delta_user_srpms_rhel72 = ( "opa-scripts", "mpi-selector", "ibacm", "libhfi1", "libpsm2", "hfi1-diagtools-sw", "hfidiags", "hfi1-firmware", "hfi1-firmware_debug", "mvapich2", "openmpi", "gasnet", "openshmem", "openshmem-test-suite", - "shmem-benchmarks", "srptools", "libibmad", "infiniband-diags", "hfi1_uefi" + "shmem-benchmarks", "srptools", "libibmad", "infiniband-diags", "hfi1_uefi", "libfabric", "sandiashmem" ); my @delta_user_srpms_rhel70 = ( "opa-scripts", "libibumad", "ibacm", "mpi-selector", @@ -768,19 +911,31 @@ "opa-scripts", "libibumad3", "ibacm", "mpi-selector", "libhfi1", "libpsm2", "hfi1-diagtools-sw", "hfidiags", "hfi1-firmware", "hfi1-firmware_debug", "mvapich2", "openmpi", "gasnet", "openshmem", "openshmem-test-suite", - "shmem-benchmarks", "srptools", "libibmad5", "infiniband-diags", "hfi1_uefi" + "shmem-benchmarks", "srptools", "libibmad5", "infiniband-diags", "hfi1_uefi", "libfabric", "sandiashmem" ); my @delta_user_srpms_sles12_sp2 = ( "opa-scripts", "mpi-selector", "libpsm2", "hfi1-diagtools-sw", "hfidiags", "hfi1-firmware", "hfi1-firmware_debug", "mvapich2", "openmpi", "gasnet", "openshmem", "openshmem-test-suite", - "shmem-benchmarks", "infiniband-diags", "hfi1_uefi" + "shmem-benchmarks", "infiniband-diags", "hfi1_uefi", "libfabric", "sandiashmem" ); my @delta_user_srpms_rhel73 = ( "opa-scripts", "mpi-selector", "libpsm2", "hfi1-diagtools-sw", "hfidiags", "hfi1-firmware", "hfi1-firmware_debug", "mvapich2", "openmpi", "gasnet", "openshmem", "openshmem-test-suite", - "shmem-benchmarks", "infiniband-diags", "hfi1_uefi" + "shmem-benchmarks", "infiniband-diags", "hfi1_uefi", "libfabric", "sandiashmem" +); +my @delta_user_srpms_sles12_sp3 = ( + "opa-scripts", "mpi-selector", + "libpsm2", "hfi1-diagtools-sw", "hfidiags", "hfi1-firmware", "hfi1-firmware_debug", + "mvapich2", "openmpi", "gasnet", "openshmem", "openshmem-test-suite", + "shmem-benchmarks", "hfi1_uefi", "libfabric", "sandiashmem" +); +my @delta_user_srpms_rhel74 = ( + "opa-scripts", "mpi-selector", + "libpsm2", "hfi1-diagtools-sw", "hfidiags", "hfi1-firmware", "hfi1-firmware_debug", + "mvapich2", "openmpi", "gasnet", "openshmem", "openshmem-test-suite", + "shmem-benchmarks", "hfi1_uefi", "libfabric", "sandiashmem" ); my @delta_user_srpms = ( ); @@ -790,6 +945,10 @@ my @delta_srpms = ( ); # This provides information for all kernel and user space srpms +# Only srpms listed in @delta_srpms, @delta_user_srpms, @delta_kernel_srpms +# are considered for install +# As such, this may list some srpms which are N/A to the selected distro +# # Fields: # Available => indicate which platforms each srpm can be built for # PostReq => after building each srpm, some of its generated rpms will @@ -806,124 +965,111 @@ # mode is optional, default is "any" # Typically mode should be "user" for libraries # See rpm_is_installed for more information about mode -my %compat_rdma_srpm_info = ( +my %delta_srpm_info = ( + # only used in other, rhel70 and sles "compat-rdma" => { Available => "", Builds => "compat-rdma compat-rdma-devel", PostReq => "compat-rdma compat-rdma-devel", PartOf => "", # filled in at runtime BuildPrereq => [], }, -); - -my %hfi1_psm_srpm_info = ( + # only used in sles12sp2 + "ifs-kernel-updates-kmp-default" => { Available => "", + Builds => "ifs-kernel-updates-kmp-default ifs-kernel-updates-devel", + PostReq => "ifs-kernel-updates-devel", + PartOf => "", # filled in at runtime + BuildPrereq => [], + }, + # only used in rhel72 and rhel73 + "kmod-ifs-kernel-updates" => { Available => "", + Builds => "kmod-ifs-kernel-updates ifs-kernel-updates-devel", + PostReq => "ifs-kernel-updates-devel", + PartOf => "", # filled in at runtime + BuildPrereq => [], + }, + # only used in rhel67 + "ifs-kernel-updates" => { Available => "", + Builds => "ifs-kernel-updates ifs-kernel-updates-devel", + PostReq => "ifs-kernel-updates-devel", + PartOf => "", # filled in at runtime + BuildPrereq => [], + }, "libpsm2" => { Available => "", Builds => "libpsm2 libpsm2-devel libpsm2-compat", PostReq => "libpsm2 libpsm2-devel libpsm2-compat", PartOf => "", # filled in at runtime BuildPrereq => [], }, -); - -my %libhfi1_srpm_info = ( + # not used in rhel73 "libhfi1" => { Available => "", Builds => "libhfi1 libhfi1-static", PostReq => "", PartOf => "", # filled in at runtime BuildPrereq => [], }, -); - -my %hfi1_diagtools_sw_srpm_info = ( "hfi1-diagtools-sw" => { Available => "", Builds => "hfi1-diagtools-sw hfi1-diagtools-sw-debuginfo", PostReq => "", PartOf => "", # filled in at runtime BuildPrereq => [ 'readline-devel', 'ncurses-devel', ], }, -); - -my %hfidiags_srpm_info = ( "hfidiags" => { Available => "", Builds => "hfidiags", PostReq => "", PartOf => "", # filled in at runtime BuildPrereq => [], }, -); - -my %hfi1_firmware_srpm_info = ( "hfi1-firmware" => { Available => "", Builds => "hfi1-firmware", PostReq => "", PartOf => "", # filled in at runtime BuildPrereq => [], }, -); - -my %hfi1_firmware_debug_srpm_info = ( "hfi1-firmware_debug" => { Available => "", Builds => "hfi1-firmware_debug", PostReq => "", PartOf => "", # filled in at runtime BuildPrereq => [], }, -); - -my %ib_wfr_lite_srpm_info = ( "ib_wfr_lite" => { Available => "", Builds => "ib_wfr_lite", PostReq => "", PartOf => "", # filled in at runtime BuildPrereq => [], }, -); - -my %opa_scripts_srpm_info = ( "opa-scripts" => { Available => "", Builds => "opa-scripts", PostReq => "", PartOf => "", # filled in at runtime BuildPrereq => [], }, -); - -my %libibumad_srpm_info = ( + # not used for sles, sles12sp2 and rhel73 "libibumad" => { Available => "", Builds => "libibumad libibumad-devel libibumad-static libibumad-debuginfo", PostReq => "libibumad libibumad-devel", PartOf => "", # filled in at runtime BuildPrereq => [ 'libtool any user' ], }, -); - -my %libibumad3_srpm_info = ( + # only used for sles "libibumad3" => { Available => "", Builds => "libibumad3 libibumad-devel libibumad-static", PostReq => "libibumad3 libibumad-devel", PartOf => "", # filled in at runtime BuildPrereq => [ 'libtool any user' ], }, -); - -my %ibacm_srpm_info = ( + # not used for sles12sp2 and rhel73 "ibacm" => { Available => "", Builds => "ibacm ibacm-devel", PostReq => "", PartOf => "", # filled in at runtime BuildPrereq => [], }, -); - -my %mpi_selector_srpm_info = ( "mpi-selector" => { Available => "", Builds => "mpi-selector", PostReq => "mpi-selector", PartOf => "", # filled in at runtime BuildPrereq => [ 'tcsh' ], }, -); - -my %mvapich2_srpm_info = ( "mvapich2" => { Available => "", # mpitests are built by do_mvapich2_build Builds => " mvapich2_gcc mpitests_mvapich2_gcc", @@ -935,9 +1081,6 @@ 'g77', 'libgfortran any user' ], }, -); - -my %openmpi_srpm_info = ( "openmpi" => { Available => "", # mpitests are built by do_openmpi_build Builds => "openmpi_gcc mpitests_openmpi_gcc", @@ -949,72 +1092,57 @@ 'binutils' ], }, -); - -my %gasnet_srpm_info = ( "gasnet" => { Available => "", Builds => "gasnet_gcc_hfi gasnet_gcc_hfi-devel gasnet_gcc_hfi-tests", PostReq => "gasnet_gcc_hfi gasnet_gcc_hfi-devel", PartOf => "", # filled in at runtime BuildPrereq => [ ], }, -); - -my %openshmem_srpm_info = ( "openshmem" => { Available => "", Builds => "openshmem_gcc_hfi", PostReq => "openshmem_gcc_hfi", PartOf => "", # filled in at runtime BuildPrereq => [ ], }, -); - -my %openshmem_test_suite_srpm_info = ( "openshmem-test-suite" => { Available => "", Builds => "openshmem-test-suite_gcc_hfi", PostReq => "", PartOf => "", # filled in at runtime BuildPrereq => [], }, -); - -my %shmem_benchmarks_srpm_info = ( "shmem-benchmarks" => { Available => "", Builds => "shmem-benchmarks_gcc_hfi", PostReq => "", PartOf => "", # filled in at runtime BuildPrereq => [], }, -); - -my %srptools_srpm_info = ( + "sandiashmem" => { Available => "", + Builds => "sandia-openshmem_gcc_hfi sandia-openshmem_gcc_hfi-devel sandia-openshmem_gcc_hfi-tests", + PostReq => "sandia-openshmem_gcc_hfi sandia-openshmem_gcc_hfi-devel", + PartOf => "", # filled in at runtime + BuildPrereq => [ ], + }, + # not used for sles12sp2 and rhel73 "srptools" => { Available => "", Builds => "srptools srptools-debuginfo", PostReq => "", PartOf => "", # filled in at runtime BuildPrereq => [ 'libtool any user' ], }, -); - -my %libibmad_srpm_info = ( + # not used for sles, sles12sp2 and rhel73 "libibmad" => { Available => "", Builds => "libibmad libibmad-devel libibmad-static", PostReq => "libibmad libibmad-devel", PartOf => "", # filled in at runtime BuildPrereq => [ 'libtool any user' ], }, -); - -my %libibmad5_srpm_info = ( + # only used for sles "libibmad5" => { Available => "", Builds => "libibmad5 libibmad-devel libibmad-static", PostReq => "libibmad5 libibmad-devel", PartOf => "", # filled in at runtime BuildPrereq => [ 'libtool any user' ], }, -); - -my %infiniband_diags_srpm_info = ( "infiniband-diags" => { Available => "", Builds => "infiniband-diags infiniband-diags-compat", PostReq => "infiniband-diags", @@ -1023,208 +1151,20 @@ 'glib2-devel any user', ], }, -); - -my %hfi1_uefi_srpm_info = ( "hfi1_uefi" => { Available => "", Builds => "hfi1-uefi", PostReq => "", PartOf => "", BuildPrereq => [], }, -); - -my %kmp_ifs_kernel_updates_srpm_info = ( - "ifs-kernel-updates-kmp-default" => { Available => "", - Builds => "ifs-kernel-updates-kmp-default ifs-kernel-updates-devel", - PostReq => "ifs-kernel-updates-devel", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, -); - -my %kmod_ifs_kernel_updates_srpm_info = ( - "kmod-ifs-kernel-updates" => { Available => "", - Builds => "kmod-ifs-kernel-updates ifs-kernel-updates-devel", - PostReq => "ifs-kernel-updates-devel", - PartOf => "", # filled in at runtime - BuildPrereq => [], + "libfabric" => { Available => "", + Builds => "libfabric libfabric-devel libfabric-psm libfabric-psm2 libfabric-verbs", + PostReq => "libfabric libfabric-devel", + PartOf => "", # filled in at runtime + BuildPrereq => [], }, ); -my %ifs_kernel_updates_rhel67_srpm_info = ( - "ifs-kernel-updates" => { Available => "", - Builds => "ifs-kernel-updates ifs-kernel-updates-devel", - PostReq => "ifs-kernel-updates-devel", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, -); - -my %delta_srpm_info_other = ( - %compat_rdma_srpm_info, - %hfi1_psm_srpm_info, - %libhfi1_srpm_info, - %hfi1_diagtools_sw_srpm_info, - %hfidiags_srpm_info, - %hfi1_firmware_srpm_info, - %hfi1_firmware_debug_srpm_info, - %ib_wfr_lite_srpm_info, - %opa_scripts_srpm_info, - %libibumad_srpm_info, - %ibacm_srpm_info, - %mpi_selector_srpm_info, - %mvapich2_srpm_info, - %openmpi_srpm_info, - %gasnet_srpm_info, - %openshmem_srpm_info, - %openshmem_test_suite_srpm_info, - %shmem_benchmarks_srpm_info, - %srptools_srpm_info, - %libibmad_srpm_info, - %infiniband_diags_srpm_info, - %hfi1_uefi_srpm_info, -); - -my %delta_srpm_info_rhel67 = ( - %ifs_kernel_updates_rhel67_srpm_info, - %hfi1_psm_srpm_info, - %libhfi1_srpm_info, - %hfi1_diagtools_sw_srpm_info, - %hfidiags_srpm_info, - %hfi1_firmware_srpm_info, - %hfi1_firmware_debug_srpm_info, - %ib_wfr_lite_srpm_info, - %opa_scripts_srpm_info, - %libibumad_srpm_info, - %ibacm_srpm_info, - %mpi_selector_srpm_info, - %mvapich2_srpm_info, - %openmpi_srpm_info, - %gasnet_srpm_info, - %openshmem_srpm_info, - %openshmem_test_suite_srpm_info, - %shmem_benchmarks_srpm_info, - %srptools_srpm_info, - %libibmad_srpm_info, - %infiniband_diags_srpm_info, - %hfi1_uefi_srpm_info, -); - -my %delta_srpm_info_rhel72 = ( - %kmod_ifs_kernel_updates_srpm_info, - %hfi1_psm_srpm_info, - %libhfi1_srpm_info, - %hfi1_diagtools_sw_srpm_info, - %hfidiags_srpm_info, - %hfi1_firmware_srpm_info, - %hfi1_firmware_debug_srpm_info, - %ib_wfr_lite_srpm_info, - %opa_scripts_srpm_info, - %libibumad_srpm_info, - %ibacm_srpm_info, - %mpi_selector_srpm_info, - %mvapich2_srpm_info, - %openmpi_srpm_info, - %gasnet_srpm_info, - %openshmem_srpm_info, - %openshmem_test_suite_srpm_info, - %shmem_benchmarks_srpm_info, - %srptools_srpm_info, - %libibmad_srpm_info, - %infiniband_diags_srpm_info, - %hfi1_uefi_srpm_info, -); - -my %delta_srpm_info_rhel70 = ( - %compat_rdma_srpm_info, - %hfi1_psm_srpm_info, - %libhfi1_srpm_info, - %hfi1_diagtools_sw_srpm_info, - %hfidiags_srpm_info, - %hfi1_firmware_srpm_info, - %hfi1_firmware_debug_srpm_info, - %ib_wfr_lite_srpm_info, - %opa_scripts_srpm_info, - %libibumad_srpm_info, - %ibacm_srpm_info, - %mpi_selector_srpm_info, - %mvapich2_srpm_info, - %openmpi_srpm_info, - %gasnet_srpm_info, - %openshmem_srpm_info, - %openshmem_test_suite_srpm_info, - %shmem_benchmarks_srpm_info, - %srptools_srpm_info, -# %libibmad_srpm_info, -# %infiniband_diags_srpm_info, -); - -my %delta_srpm_info_sles = ( - %compat_rdma_srpm_info, - %hfi1_psm_srpm_info, - %libhfi1_srpm_info, - %hfi1_diagtools_sw_srpm_info, - %hfidiags_srpm_info, - %hfi1_firmware_srpm_info, - %hfi1_firmware_debug_srpm_info, - %ib_wfr_lite_srpm_info, - %opa_scripts_srpm_info, - %libibumad3_srpm_info, - %ibacm_srpm_info, - %mpi_selector_srpm_info, - %mvapich2_srpm_info, - %openmpi_srpm_info, - %gasnet_srpm_info, - %openshmem_srpm_info, - %openshmem_test_suite_srpm_info, - %shmem_benchmarks_srpm_info, - %srptools_srpm_info, - %libibmad5_srpm_info, - %infiniband_diags_srpm_info, - %hfi1_uefi_srpm_info, -); - -my %delta_srpm_info_sles12_sp2 = ( - %kmp_ifs_kernel_updates_srpm_info, - %hfi1_psm_srpm_info, - %hfi1_diagtools_sw_srpm_info, - %hfidiags_srpm_info, - %hfi1_firmware_srpm_info, - %hfi1_firmware_debug_srpm_info, - %opa_scripts_srpm_info, - %mpi_selector_srpm_info, - %mvapich2_srpm_info, - %openmpi_srpm_info, - %gasnet_srpm_info, - %openshmem_srpm_info, - %openshmem_test_suite_srpm_info, - %shmem_benchmarks_srpm_info, - %infiniband_diags_srpm_info, - %hfi1_uefi_srpm_info, -); - -my %delta_srpm_info_rhel73 = ( - %kmod_ifs_kernel_updates_srpm_info, - %hfi1_psm_srpm_info, - %hfi1_diagtools_sw_srpm_info, - %hfidiags_srpm_info, - %hfi1_firmware_srpm_info, - %hfi1_firmware_debug_srpm_info, - %opa_scripts_srpm_info, - %mpi_selector_srpm_info, - %mvapich2_srpm_info, - %openmpi_srpm_info, - %gasnet_srpm_info, - %openshmem_srpm_info, - %openshmem_test_suite_srpm_info, - %shmem_benchmarks_srpm_info, - %infiniband_diags_srpm_info, - %hfi1_uefi_srpm_info, -); - -my %delta_srpm_info = ( ); - # This provides information for all kernel and user space rpms # This is built based on information in delta_srpm_info and delta_comp_info # Fields: @@ -1271,44 +1211,48 @@ ($) %delta_comp_info = ( %delta_comp_info_sles ); @delta_kernel_srpms = ( @delta_kernel_srpms_sles ); @delta_user_srpms = ( @delta_user_srpms_sles ); - %delta_srpm_info = ( %delta_srpm_info_sles ); } elsif ("$CUR_DISTRO_VENDOR" eq 'SuSE' && "$CUR_VENDOR_VER" eq 'ES122') { @delta_components = ( @delta_components_sles12_sp2 ); %delta_comp_info = ( %delta_comp_info_sles12_sp2 ); @delta_kernel_srpms = ( @delta_kernel_srpms_sles12_sp2 ); @delta_user_srpms = ( @delta_user_srpms_sles12_sp2 ); - %delta_srpm_info = ( %delta_srpm_info_sles12_sp2 ); + } elsif ("$CUR_DISTRO_VENDOR" eq 'SuSE' + && "$CUR_VENDOR_VER" eq 'ES123') { + @delta_components = ( @delta_components_sles12_sp3 ); + %delta_comp_info = ( %delta_comp_info_sles12_sp3 ); + @delta_kernel_srpms = ( @delta_kernel_srpms_sles12_sp3 ); + @delta_user_srpms = ( @delta_user_srpms_sles12_sp3 ); + } elsif ( "$CUR_VENDOR_VER" eq "ES74" ) { + @delta_components = ( @delta_components_rhel74 ); + %delta_comp_info = ( %delta_comp_info_rhel74 ); + @delta_kernel_srpms = ( @delta_kernel_srpms_rhel74 ); + @delta_user_srpms = ( @delta_user_srpms_rhel74 ); } elsif ( "$CUR_VENDOR_VER" eq "ES73" ) { @delta_components = ( @delta_components_rhel73 ); %delta_comp_info = ( %delta_comp_info_rhel73 ); @delta_kernel_srpms = ( @delta_kernel_srpms_rhel73 ); @delta_user_srpms = ( @delta_user_srpms_rhel73 ); - %delta_srpm_info = ( %delta_srpm_info_rhel73 ); } elsif ( "$CUR_VENDOR_VER" eq "ES72" ) { @delta_components = ( @delta_components_rhel72 ); %delta_comp_info = ( %delta_comp_info_rhel72 ); @delta_kernel_srpms = ( @delta_kernel_srpms_rhel72 ); @delta_user_srpms = ( @delta_user_srpms_rhel72 ); - %delta_srpm_info = ( %delta_srpm_info_rhel72 ); } elsif ( "$CUR_VENDOR_VER" eq "ES7" ) { @delta_components = ( @delta_components_rhel70 ); %delta_comp_info = ( %delta_comp_info_rhel70 ); @delta_kernel_srpms = ( @delta_kernel_srpms_rhel70 ); @delta_user_srpms = ( @delta_user_srpms_rhel70 ); - %delta_srpm_info = ( %delta_srpm_info_rhel70 ); } elsif ( "$CUR_VENDOR_VER" eq "ES67" ) { @delta_components = ( @delta_components_rhel67 ); %delta_comp_info = ( %delta_comp_info_rhel67 ); @delta_kernel_srpms = ( @delta_kernel_srpms_rhel67 ); @delta_user_srpms = ( @delta_user_srpms_rhel67 ); - %delta_srpm_info = ( %delta_srpm_info_rhel67 ); } else { @delta_components = ( @delta_components_other ); %delta_comp_info = ( %delta_comp_info_other ); @delta_kernel_srpms = ( @delta_kernel_srpms_other ); @delta_user_srpms = ( @delta_user_srpms_other ); - %delta_srpm_info = ( %delta_srpm_info_other ); } @delta_srpms = ( @delta_kernel_srpms, @delta_user_srpms, @delta_other_srpms ); @@ -1452,7 +1396,7 @@ ($$$@) $rpmdir_t=$rpmdir; if ($delta_rpm_info{$package}{'Available'} ) { if ( "$delta_rpm_info{$package}{'Mode'}" eq "kernel" ) { - if ( "$CUR_VENDOR_VER" eq "ES72" || "$CUR_VENDOR_VER" eq "ES73" || "$CUR_VENDOR_VER" eq "ES122" ) { + if ( "$CUR_VENDOR_VER" eq "ES72" || "$CUR_VENDOR_VER" eq "ES73" || "$CUR_VENDOR_VER" eq "ES122" || "$CUR_VENDOR_VER" eq "ES74" || "$CUR_VENDOR_VER" eq "ES123") { if ( $package =~ /ifs-kernel-updates/ ) { if ( $GPU_Install == 1 ) { $rpmdir_t=$rpmdir."/CUDA"; @@ -1797,13 +1741,14 @@ ($$$$$@) # main changes from cut and paste are marked with # IFS commands # this has an srpm orientation and is only called when we really want to # build the srpm -sub build_srpm($$$$$) +sub build_srpm($$$$$$) { my $srpm = shift(); # the srpm package name my $TOPDIR = shift(); # top directory for build my $BUILD_ROOT = shift(); # temp directory for build my $prefix = shift(); # prefix for install path my $resfileop = shift(); # append or replace build.res file + my $kernel_ver = shift(); my $configure_options = ''; # delta keeps per srpm, but only initializes here my $srcdir=$ComponentInfo{'opa_stack'}{'SrcDir'}; my $SRC_RPM = delta_srpm_file($srcdir, "$srpm*.src.rpm"); @@ -1938,6 +1883,10 @@ ($$$$$) $cmd .= " --define 'openshmem_prefix /usr/shmem/gcc/openshmem-1.3-hfi'"; } + if ("$srpm" eq "kmod-ifs-kernel-updates" || "$srpm" eq "ifs-kernel-updates-kmp-default"){ + $cmd .= " --define 'kver $kernel_ver'"; + } + return run_build("$srcdir $SRC_RPM $RPM_ARCH", "$srcdir", $cmd, "$resfileop"); } # NOTREACHED @@ -2177,7 +2126,7 @@ ($$$$$$) if ($build_kernel) { $resfileop = "append"; - if (0 != build_srpm($srpm, $RPM_DIR, $BUILD_ROOT, $prefix, $resfileop)) { + if (0 != build_srpm($srpm, $RPM_DIR, $BUILD_ROOT, $prefix, $resfileop, $K_VER)) { return 1; # failure } @need_install = ( @need_install, split /[[:space:]]+/, $delta_srpm_info{$srpm}{'PostReq'}); @@ -2242,7 +2191,7 @@ ($$$$$$) $must_force_rpm=1; } else { # all non-MPI user RPMs if ($build_user) { - if (0 != build_srpm($srpm, $RPM_DIR, $BUILD_ROOT, $prefix, $resfileop)) { + if (0 != build_srpm($srpm, $RPM_DIR, $BUILD_ROOT, $prefix, $resfileop, $K_VER)) { return 1; # failure } $resfileop = "append"; @@ -2626,11 +2575,15 @@ ($$) # special handling for compat-rdma if ($ComponentInfo{$comp}{'DriverSubdir'} ne "" ) { install_kernel_ib(delta_rpms_dir(), $install_list); + # skip compat-rdma if in KernelRpms/UserRpms, already handled above + delta_rpm_install_list(delta_rpms_dir(), $CUR_OS_VER, 1, + ( @{ $delta_comp_info{$comp}{'KernelRpms'}}, + @{ $delta_comp_info{$comp}{'UserRpms'}}) ); + } else { + delta_rpm_install_list(delta_rpms_dir(), $CUR_OS_VER, 0, + ( @{ $delta_comp_info{$comp}{'KernelRpms'}}, + @{ $delta_comp_info{$comp}{'UserRpms'}}) ); } - # skip compat-rdma if in KernelRpms/UserRpms, already handled above - delta_rpm_install_list(delta_rpms_dir(), $CUR_OS_VER, 1, - ( @{ $delta_comp_info{$comp}{'KernelRpms'}}, - @{ $delta_comp_info{$comp}{'UserRpms'}}) ); # DebugRpms are installed as part of 'delta_debug' component } @@ -2784,9 +2737,15 @@ () } elsif ( "$CUR_VENDOR_VER" eq "ES73" ) { return ( -e "$ROOT$BASE_DIR/version_delta" && rpm_is_installed("kmod-ifs-kernel-updates", $CUR_OS_VER)); + } elsif ( "$CUR_VENDOR_VER" eq "ES74" ) { + return ( -e "$ROOT$BASE_DIR/version_delta" + && rpm_is_installed("kmod-ifs-kernel-updates", $CUR_OS_VER)); } elsif ( "$CUR_VENDOR_VER" eq 'ES122' ) { return ( -e "$ROOT$BASE_DIR/version_delta" && rpm_is_installed("ifs-kernel-updates-kmp-default", $CUR_OS_VER)); + } elsif ( "$CUR_VENDOR_VER" eq 'ES123' ) { + return ( -e "$ROOT$BASE_DIR/version_delta" + && rpm_is_installed("ifs-kernel-updates-kmp-default", $CUR_OS_VER)); } elsif ( "$CUR_VENDOR_VER" eq 'ES12' || "$CUR_VENDOR_VER" eq 'ES121' ) { return (rpm_is_installed("libibumad3", "user") && -e "$ROOT$BASE_DIR/version_delta" @@ -3052,7 +3011,7 @@ () return ( -e "$ROOT$BASE_DIR/version_delta" && rpm_is_installed("libhfi1", "user") && rpm_is_installed("ifs-kernel-updates", $CUR_OS_VER)); - } elsif ( "$CUR_VENDOR_VER" eq "ES72" || "$CUR_VENDOR_VER" eq "ES73" ) { + } elsif ( "$CUR_VENDOR_VER" eq "ES72" || "$CUR_VENDOR_VER" eq "ES73" ) { return (rpm_is_installed("libhfi1", "user") && -e "$ROOT$BASE_DIR/version_delta" && rpm_is_installed("kmod-ifs-kernel-updates", $CUR_OS_VER)); @@ -3060,8 +3019,14 @@ () return (rpm_is_installed("libhfi1verbs-rdmav2", "user") && -e "$ROOT$BASE_DIR/version_delta" && rpm_is_installed("ifs-kernel-updates-kmp-default", $CUR_OS_VER)); + } elsif ( "$CUR_VENDOR_VER" eq "ES74" ) { + return (-e "$ROOT$BASE_DIR/version_delta" + && rpm_is_installed("kmod-ifs-kernel-updates", $CUR_OS_VER)); + } elsif ( "$CUR_VENDOR_VER" eq "ES123" ) { + return ( -e "$ROOT$BASE_DIR/version_delta" + && rpm_is_installed("ifs-kernel-updates-kmp-default", $CUR_OS_VER)); } else { - return (rpm_is_installed("libhfi1", "user") + return (rpm_is_installed("libhfi1", "user") && -e "$ROOT$BASE_DIR/version_delta" && rpm_is_installed("compat-rdma", $CUR_OS_VER)); } @@ -3307,8 +3272,13 @@ () sub installed_opa_stack_dev() { - return (rpm_is_installed("libibumad-devel", "user") + if ( "$CUR_VENDOR_VER" eq "ES74" || "$CUR_VENDOR_VER" eq "ES123") { + return (rpm_is_installed("rdma-core-devel", "user") && -e "$ROOT$BASE_DIR/version_delta"); + } else { + return (rpm_is_installed("libibumad-devel", "user") + && -e "$ROOT$BASE_DIR/version_delta"); + } } # only called if installed_opa_stack_dev is true @@ -3383,8 +3353,6 @@ ($$) # ========================================================================== # OFED delta_ipoib installation -my $FirstIPoIBInterface=0; # first device is ib0 - # determine if the given capability is configured for Autostart at boot sub IsAutostart2_delta_ipoib() { @@ -3985,6 +3953,106 @@ sub check_os_prereqs_openshmem return rpm_check_os_prereqs("openshmem", "user"); } +# ========================================================================== +# OFED sandiashmem for gcc installation + +sub available_sandiashmem() +{ + my $srcdir=$ComponentInfo{'sandiashmem'}{'SrcDir'}; + return ( -d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ); +} + +sub installed_sandiashmem() +{ + return ((rpm_is_installed("sandia-openshmem_gcc_hfi", "user") + && -e "$ROOT$BASE_DIR/version_delta")); +} + +# only called if installed_openshmem is true +sub installed_version_sandiashmem() +{ + return `cat $ROOT$BASE_DIR/version_delta`; +} + +# only called if available_openshmem is true +sub media_version_sandiashmem() +{ + return media_version_delta(); +} + +sub build_sandiashmem($$$$) +{ + my $osver = shift(); + my $debug = shift(); # enable extra debug of build itself + my $build_temp = shift(); # temp area for use by build + my $force = shift(); # force a rebuild + return 0; # success +} + +sub need_reinstall_sandiashmem($$) +{ + my $install_list = shift(); # total that will be installed when done + my $installing_list = shift(); # what items are being installed/reinstalled + + return (need_reinstall_delta_comp('sandiashmem', $install_list, $installing_list)); +} + +sub preinstall_sandiashmem($$) +{ + my $install_list = shift(); # total that will be installed when done + my $installing_list = shift(); # what items are being installed/reinstalled + + return preinstall_delta("sandiashmem", $install_list, $installing_list); +} + +sub install_sandiashmem($$) +{ + my $install_list = shift(); # total that will be installed when done + my $installing_list = shift(); # what items are being installed/reinstalled + + print_install_banner_delta_comp('sandiashmem'); + + # make sure any old potentially custom built versions of sandiashmem are uninstalled + rpm_uninstall_list2("any", " --nodeps ", 'silent', @{ $delta_comp_info{'sandiashmem'}{'UserRpms'}}); + my $rpmfile = rpm_resolve(delta_rpms_dir(), "any", "sandia-openshmem_gcc_hfi"); + if ( "$rpmfile" ne "" && -e "$rpmfile" ) { + my $sandiashm_prefix = "$OFED_prefix/shmem/gcc/sandia-openshmem-"; + $sandiashm_prefix .= rpm_query_attr($rpmfile, "VERSION"); + $sandiashm_prefix .= "-hfi"; + if ( -d "$sandiashm_prefix" && GetYesNo ("Remove $sandiashm_prefix directory?", "y")) { + LogPrint "rm -rf $sandiashm_prefix\n"; + system("rm -rf $sandiashm_prefix"); + } + } + + install_delta_comp('sandiashmem', $install_list); + + $ComponentWasInstalled{'sandiashmem'}=1; +} + +sub postinstall_sandiashmem($$) +{ + my $install_list = shift(); # total that will be installed when done + my $installing_list = shift(); # what items are being installed/reinstalled + #delta_restore_autostart('sandiashmem'); +} + +sub uninstall_sandiashmem($$) +{ + my $install_list = shift(); # total that will be left installed when done + my $uninstalling_list = shift(); # what items are being uninstalled + + print_uninstall_banner_delta_comp('sandiashmem'); + uninstall_delta_comp('sandiashmem', $install_list, $uninstalling_list, 'verbose'); +# delta_cleanup_mpitests(); + $ComponentWasInstalled{'sandiashmem'}=0; +} + +sub check_os_prereqs_sandiashmem +{ + return rpm_check_os_prereqs("sandiashmem", "user"); +} + # ========================================================================== # OFED DELTA delta_mpisrc installation diff --git a/CommonInstall/comp_delta_prereq_RHEL72.pl b/CommonInstall/comp_delta_prereq_RHEL72.pl index 9701794c..bf4231d4 100644 --- a/CommonInstall/comp_delta_prereq_RHEL72.pl +++ b/CommonInstall/comp_delta_prereq_RHEL72.pl @@ -77,10 +77,9 @@ "glibc", "libgcc", "libibverbs", - "libuuid", - "libuuid-devel", "python", "systemd", + "numactl-libs", "irqbalance", ); $comp_prereq_hash{'intel_hfi_prereq'} = \@intel_hfi_prereq; diff --git a/CommonInstall/comp_delta_prereq_RHEL73.pl b/CommonInstall/comp_delta_prereq_RHEL73.pl index 7a23bfa9..8c0b70d0 100644 --- a/CommonInstall/comp_delta_prereq_RHEL73.pl +++ b/CommonInstall/comp_delta_prereq_RHEL73.pl @@ -68,10 +68,9 @@ "libhfi1", "glibc", "libgcc", - "libuuid", - "libuuid-devel", "python", "systemd", + "numactl-libs", "irqbalance", ); $comp_prereq_hash{'intel_hfi_prereq'} = \@intel_hfi_prereq; diff --git a/CommonInstall/comp_delta_prereq_RHEL74.pl b/CommonInstall/comp_delta_prereq_RHEL74.pl new file mode 100644 index 00000000..854e026f --- /dev/null +++ b/CommonInstall/comp_delta_prereq_RHEL74.pl @@ -0,0 +1,155 @@ +#!/usr/bin/perl +## BEGIN_ICS_COPYRIGHT8 **************************************** +## +## Copyright (c) 2015, Intel Corporation +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## * Redistributions of source code must retain the above copyright notice, +## this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of Intel Corporation nor the names of its contributors +## may be used to endorse or promote products derived from this software +## without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +## DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +## SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +## CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## END_ICS_COPYRIGHT8 **************************************** +# +## [ICS VERSION STRING: unknown] +#use strict; +##use Term::ANSIColor; +##use Term::ANSIColor qw(:constants); +##use File::Basename; +##use Math::BigInt; +# +## ========================================================================== +# +#Installation Prequisites array for delta components +my @opa_stack_prereq = ( + "bash", + "kernel", + "kmod", + "rdma-core", + "systemd", + "glibc", + "pciutils", + "opensm-libs", + "libibmad", + "libibcm", + "libibumad", + "rdma-core-devel", +); +$comp_prereq_hash{'opa_stack_prereq'} = \@opa_stack_prereq; + +my @mpi_selector_prereq = ( + "bash", + "coreutils", + "perl", + "perl-Getopt-Long", + "tcsh", +); +$comp_prereq_hash{'mpi_selector_prereq'} = \@mpi_selector_prereq; + +my @intel_hfi_prereq = ( + "bash", + "glibc", + "libgcc", + "python", + "systemd", + "numactl-libs", + "irqbalance", +); +$comp_prereq_hash{'intel_hfi_prereq'} = \@intel_hfi_prereq; + +my @mvapich2_prereq = ( + "bash", + "libibverbs", + "librdmacm", + "glibc", + "zlib", + "sysfsutils", +); +$comp_prereq_hash{'mvapich2_prereq'} = \@mvapich2_prereq; + +my @openmpi_prereq = ( + "bash", + "glibc", + "libgcc", + "libgfortran", + "gcc-gfortran", + "libgomp", + "libibverbs", + "libquadmath", + "librdmacm", + "libstdc++", + "libstdc++-devel", + "opensm-libs", + "papi", + "pkgconfig", + "zlib", +); +$comp_prereq_hash{'openmpi_prereq'} = \@openmpi_prereq; + +my @gasnet_prereq = ( + "bash", + "glibc", +); +$comp_prereq_hash{'gasnet_prereq'} = \@gasnet_prereq; + +my @openshmem_prereq = ( + "bash", + "elfutils-libelf-devel", + "elfutils-libelf", + "glibc", +); +$comp_prereq_hash{'openshmem_prereq'} = \@openshmem_prereq; + +my @mvapich2_gcc_hfi_prereq = ( + "bash", + "zlib", + "glibc", +); +$comp_prereq_hash{'mvapich2_gcc_hfi_prereq'} = \@mvapich2_gcc_hfi_prereq; + +my @mvapich2_intel_hfi_prereq = ( + "bash", +); +$comp_prereq_hash{'mvapich2_intel_hfi_prereq'} = \@mvapich2_intel_hfi_prereq; + +my @openmpi_gcc_hfi_prereq = ( + "bash", + "glibc", + "infinipath-psm", + "libgcc", + "libgfortran", + "gcc-gfortran", + "libgomp", + "libibverbs", + "libquadmath", + "librdmacm", + "libstdc++", + "libstdc++-devel", + "opensm-libs", + "papi", + "pkgconfig", + "zlib", +); +$comp_prereq_hash{'openmpi_gcc_hfi_prereq'} = \@openmpi_gcc_hfi_prereq; + +my @openmpi_intel_hfi_prereq = ( + "bash", +); +$comp_prereq_hash{'openmpi_intel_hfi_prereq'} = \@openmpi_intel_hfi_prereq; diff --git a/CommonInstall/comp_delta_prereq_SLES121.pl b/CommonInstall/comp_delta_prereq_SLES121.pl index 0c7c3171..cf2fc5ee 100644 --- a/CommonInstall/comp_delta_prereq_SLES121.pl +++ b/CommonInstall/comp_delta_prereq_SLES121.pl @@ -81,10 +81,9 @@ "libgcc_s1", "libibverbs1", "libncurses5", - "libuuid1", - "libuuid-devel", "python-base", "udev", + "libnuma1", "irqbalance", ); $comp_prereq_hash{'intel_hfi_prereq'} = \@intel_hfi_prereq; diff --git a/CommonInstall/comp_delta_prereq_SLES122.pl b/CommonInstall/comp_delta_prereq_SLES122.pl index 42cc51d0..34fb4d9c 100644 --- a/CommonInstall/comp_delta_prereq_SLES122.pl +++ b/CommonInstall/comp_delta_prereq_SLES122.pl @@ -64,14 +64,13 @@ "glibc", "libhfi1verbs-rdmav2", "libgcc_s1", - "libuuid1", "bash", - "libuuid-devel", "udev", "libudev-devel", "python-base", "libedit0", "libncurses5", + "libnuma1", "irqbalance", ); $comp_prereq_hash{'intel_hfi_prereq'} = \@intel_hfi_prereq; diff --git a/CommonInstall/comp_delta_prereq_SLES123.pl b/CommonInstall/comp_delta_prereq_SLES123.pl new file mode 100644 index 00000000..71a72b81 --- /dev/null +++ b/CommonInstall/comp_delta_prereq_SLES123.pl @@ -0,0 +1,155 @@ +#!/usr/bin/perl +## BEGIN_ICS_COPYRIGHT8 **************************************** +## +## Copyright (c) 2015, Intel Corporation +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## * Redistributions of source code must retain the above copyright notice, +## this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of Intel Corporation nor the names of its contributors +## may be used to endorse or promote products derived from this software +## without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +## DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +## SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +## CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## END_ICS_COPYRIGHT8 **************************************** +# +## [ICS VERSION STRING: unknown] +#use strict; +##use Term::ANSIColor; +##use Term::ANSIColor qw(:constants); +##use File::Basename; +##use Math::BigInt; +# +## ========================================================================== +# +#Installation Prequisites array for delta components +my @opa_stack_prereq = ( + "bash", + "kmod", + "rdma-core", + "systemd", + "coreutils", + "grep", + "opensm-libs3", + "libibmad5", + "libibcm1", + "libibumad3", + "rdma-core-devel", +); +$comp_prereq_hash{'opa_stack_prereq'} = \@opa_stack_prereq; + +my @mpi_selector_prereq = ( + "bash", + "coreutils", + "tcsh", +); +$comp_prereq_hash{'mpi_selector_prereq'} = \@mpi_selector_prereq; + +my @intel_hfi_prereq = ( + "glibc", + "libgcc_s1", + "bash", + "udev", + "libudev-devel", + "python-base", + "libedit0", + "libncurses5", + "libnuma1", + "irqbalance", +); +$comp_prereq_hash{'intel_hfi_prereq'} = \@intel_hfi_prereq; + +my @mvapich2_gcc_hfi_prereq = ( + "bash", + "glibc", + "libz1", +); +$comp_prereq_hash{'mvapich2_gcc_hfi_prereq'} = \@mvapich2_gcc_hfi_prereq; + +my @mvapich2_intel_hfi_prereq = ( + "bash", +); +$comp_prereq_hash{'mvapich2_intel_hfi_prereq'} = \@mvapich2_intel_hfi_prereq; + +my @openmpi_gcc_hfi_prereq = ( + "glibc", + "bash", + "libpsm_infinipath1", + "pkg-config", + "libgcc_s1", + "libgfortran3", + "gcc-fortran", + "libgomp1", + "libibverbs1", + "libquadmath0", + "librdmacm1", + "libstdc++6", + "libz1", + "opensm-libs3", + "opensm-devel", +); +$comp_prereq_hash{'openmpi_gcc_hfi_prereq'} = \@openmpi_gcc_hfi_prereq; + +my @openmpi_intel_hfi_prereq = ( + "bash", +); +$comp_prereq_hash{'openmpi_intel_hfi_prereq'} = \@openmpi_intel_hfi_prereq; + +my @mvapich2_prereq = ( + "bash", + "libibverbs1", + "librdmacm1", + "glibc", + "libz1", +); +$comp_prereq_hash{'mvapich2_prereq'} = \@mvapich2_prereq; + +my @openmpi_prereq = ( + "glibc", + "bash", + "libz1", + "pkg-config", + "libgcc_s1", + "libgfortran3", + "gcc-fortran", + "libgomp1", + "libibverbs1", + "libquadmath0", + "librdmacm1", + "libstdc++6", + "libz1", + "opensm-libs3", + "opensm-devel", +); +$comp_prereq_hash{'openmpi_prereq'} = \@openmpi_prereq; + +my @gasnet_prereq = ( + "bash", + "coreutils", + "grep", + "glibc", +); +$comp_prereq_hash{'gasnet_prereq'} = \@gasnet_prereq; + +my @openshmem_prereq = ( + "bash", + "libelf1", + "libelf-devel", + "glibc", +); +$comp_prereq_hash{'openshmem_prereq'} = \@openshmem_prereq; diff --git a/CommonInstall/comp_fastfabric.pl b/CommonInstall/comp_fastfabric.pl index dafd4720..0968f1d3 100755 --- a/CommonInstall/comp_fastfabric.pl +++ b/CommonInstall/comp_fastfabric.pl @@ -43,13 +43,13 @@ sub available_fastfabric { my $srcdir=$ComponentInfo{'fastfabric'}{'SrcDir'}; - return ((rpm_resolve("$srcdir/RPMS/*/", "any", "opa-basic-tools") ne "") && + return ((rpm_resolve("$srcdir/RPMS/*/", "any", "opa-mpi-apps") ne "") && (rpm_resolve("$srcdir/RPMS/*/", "any", "opa-fastfabric") ne "")); } sub installed_fastfabric { - return(system("rpm -q --quiet opa-fastfabric") == 0) + return rpm_is_installed("opa-fastfabric", "any"); } # only called if installed_fastfabric is true @@ -63,7 +63,10 @@ sub installed_version_fastfabric sub media_version_fastfabric { my $srcdir=$ComponentInfo{'fastfabric'}{'SrcDir'}; - return `cat "$srcdir/version"`; + my $rpmfile = rpm_resolve("$srcdir/RPMS/*/", "any", "opa-fastfabric"); + my $version= rpm_query_version_release("$rpmfile"); + # assume media properly built with matching versions for all rpms + return dot_version("$version"); } sub build_fastfabric @@ -107,13 +110,12 @@ sub install_fastfabric my $version=media_version_fastfabric(); chomp $version; printf("Installing $ComponentInfo{'fastfabric'}{'Name'} $version $DBG_FREE...\n"); - LogPrint "Installing $ComponentInfo{'fastfabric'}{'Name'} $version $DBG_FREE for $CUR_DISTRO_VENDOR $CUR_VENDOR_VER\n"; - check_config_dirs(); + LogPrint "Installing $ComponentInfo{'fastfabric'}{'Name'} $version $DBG_FREE for $CUR_DISTRO_VENDOR $CUR_VENDOR_VER\n"; my $rpmfile = rpm_resolve("$srcdir/RPMS/*/", "any", "opa-fastfabric"); rpm_run_install($rpmfile, "any", " -U "); - check_dir("/usr/lib/opa/tools"); + # TBD - spec file should do this check_dir("/usr/share/opa/samples"); system "chmod ug+x $ROOT/usr/share/opa/samples/hostverify.sh"; system "rm -f $ROOT/usr/share/opa/samples/nodeverify.sh"; @@ -127,17 +129,17 @@ sub install_fastfabric check_rpm_config_file("$CONFIG_DIR/opa/hosts", $depricated_dir); check_rpm_config_file("$CONFIG_DIR/opa/ports", $depricated_dir); check_rpm_config_file("$CONFIG_DIR/opa/switches", $depricated_dir); +# TBD - this should not be a config file check_rpm_config_file("/usr/lib/opa/tools/osid_wrapper"); #install_conf_file("$ComponentInfo{'fastfabric'}{'Name'}", "$FF_TLS_CONF_FILE", "$srcdir/fastfabric/tools/tls"); #remove_conf_file("$ComponentInfo{'fastfabric'}{'Name'}", "$OPA_CONFIG_DIR/iba_stat.conf"); + # TBD - spec file should remove this system("rm -rf $ROOT$OPA_CONFIG_DIR/iba_stat.conf"); # old config $rpmfile = rpm_resolve("$srcdir/RPMS/*/", "any", "opa-mpi-apps"); rpm_run_install($rpmfile, "any", " -U "); - - $ComponentWasInstalled{'fastfabric'}=1; } @@ -191,14 +193,16 @@ sub installed_opamgt_sdk sub installed_version_opamgt_sdk { - return rpm_query_version_release_pkg("opa-libopamgt-devel"); + my $version = rpm_query_version_release_pkg("opa-libopamgt-devel"); + return dot_version("$version"); } sub media_version_opamgt_sdk { my $srcdir = $ComponentInfo{'opamgt_sdk'}{'SrcDir'}; my $rpm = rpm_resolve("$srcdir/RPMS/*/", "any", "opa-libopamgt-devel"); - return rpm_query_version_release($rpm); + my $version = rpm_query_version_release($rpm); + return dot_version("$version"); } sub build_opamgt_sdk diff --git a/CommonInstall/comp_ff_of_prereq_RHEL74.pl b/CommonInstall/comp_ff_of_prereq_RHEL74.pl new file mode 100644 index 00000000..cb4c3ce0 --- /dev/null +++ b/CommonInstall/comp_ff_of_prereq_RHEL74.pl @@ -0,0 +1,77 @@ +#!/usr/bin/perl +## BEGIN_ICS_COPYRIGHT8 **************************************** +## +## Copyright (c) 2015, Intel Corporation +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## * Redistributions of source code must retain the above copyright notice, +## this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of Intel Corporation nor the names of its contributors +## may be used to endorse or promote products derived from this software +## without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +## DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +## SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +## CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## END_ICS_COPYRIGHT8 **************************************** +# +## [ICS VERSION STRING: unknown] +#use strict; +##use Term::ANSIColor; +##use Term::ANSIColor qw(:constants); +##use File::Basename; +##use Math::BigInt; +# +## ========================================================================== +# +#Installation Prequisites array for fast fabric +#and of tools component +my @oftools_prereq = ( + "glibc", + "libgcc", + "libibmad", + "libibumad", + "libibverbs", + "libstdc++", + "ibacm", + "rdma-core", +); +$comp_prereq_hash{'oftools_prereq'} = \@oftools_prereq; + +my @fastfabric_prereq = ( + "atlas", + "bash", + "bc", + "expat", + "expect", + "glibc", + "libgcc", + "libibmad", + "libibumad", + "libibverbs", + "libstdc++", + "ncurses-libs", + "openssl-libs", + "perl", + "perl-Getopt-Long", + "perl-Socket", + "rdma-core", + "tcl", + "zlib", + "qperf", + "perftest", +); +$comp_prereq_hash{'fastfabric_prereq'} = \@fastfabric_prereq; diff --git a/CommonInstall/comp_ff_of_prereq_SLES123.pl b/CommonInstall/comp_ff_of_prereq_SLES123.pl new file mode 100644 index 00000000..546d8fec --- /dev/null +++ b/CommonInstall/comp_ff_of_prereq_SLES123.pl @@ -0,0 +1,74 @@ +#!/usr/bin/perl +## BEGIN_ICS_COPYRIGHT8 **************************************** +## +## Copyright (c) 2015, Intel Corporation +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## * Redistributions of source code must retain the above copyright notice, +## this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of Intel Corporation nor the names of its contributors +## may be used to endorse or promote products derived from this software +## without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +## DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +## SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +## CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## END_ICS_COPYRIGHT8 **************************************** +# +## [ICS VERSION STRING: unknown] +#use strict; +##use Term::ANSIColor; +##use Term::ANSIColor qw(:constants); +##use File::Basename; +##use Math::BigInt; +# +## ========================================================================== +# +#Installation Prequisites array for fast fabric +#and of tools component + +my @oftools_prereq = ( + "glibc", + "libgcc_s1", + "libibmad5", + "libibumad3", + "libibverbs1", + "libstdc++6", + "ibacm", +); +$comp_prereq_hash{'oftools_prereq'} = \@oftools_prereq; + +my @fastfabric_prereq = ( + "glibc", + "bash", + "expect", + "perl-base", + "tcl", + "libexpat1", + "libgcc_s1", + "libibmad5", + "libibumad3", + "libibverbs1", + "libncurses5", + "libopenssl1_0_0", + "libstdc++6", + "libz1", + "bc", + "rdma-core", + "qperf", + "perftest", +); +$comp_prereq_hash{'fastfabric_prereq'} = \@fastfabric_prereq; diff --git a/CommonInstall/comp_fm_prereq_RHEL74.pl b/CommonInstall/comp_fm_prereq_RHEL74.pl new file mode 100644 index 00000000..d0ebe339 --- /dev/null +++ b/CommonInstall/comp_fm_prereq_RHEL74.pl @@ -0,0 +1,54 @@ +#!/usr/bin/perl +## BEGIN_ICS_COPYRIGHT8 **************************************** +## +## Copyright (c) 2015, Intel Corporation +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## * Redistributions of source code must retain the above copyright notice, +## this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of Intel Corporation nor the names of its contributors +## may be used to endorse or promote products derived from this software +## without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +## DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +## SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +## CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## END_ICS_COPYRIGHT8 **************************************** +# +## [ICS VERSION STRING: unknown] +#use strict; +##use Term::ANSIColor; +##use Term::ANSIColor qw(:constants); +##use File::Basename; +##use Math::BigInt; +# +## ========================================================================== +# +#Installation Prequisites array for opafm +my @opafm_prereq = ( + "bash", + "expat", + "glibc", + "libibmad", + "libibumad", + "libibverbs", + "openssl-libs", + "rdma-core", + "systemd", + "zlib", +); +$comp_prereq_hash{'opafm_prereq'} = \@opafm_prereq; + diff --git a/CommonInstall/comp_fm_prereq_SLES123.pl b/CommonInstall/comp_fm_prereq_SLES123.pl new file mode 100644 index 00000000..674bb508 --- /dev/null +++ b/CommonInstall/comp_fm_prereq_SLES123.pl @@ -0,0 +1,53 @@ +#!/usr/bin/perl +## BEGIN_ICS_COPYRIGHT8 **************************************** +## +## Copyright (c) 2015, Intel Corporation +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## * Redistributions of source code must retain the above copyright notice, +## this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of Intel Corporation nor the names of its contributors +## may be used to endorse or promote products derived from this software +## without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +## DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +## SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +## CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## END_ICS_COPYRIGHT8 **************************************** +# +## [ICS VERSION STRING: unknown] +#use strict; +##use Term::ANSIColor; +##use Term::ANSIColor qw(:constants); +##use File::Basename; +##use Math::BigInt; +# +## ========================================================================== +# +##Installation Prequisites array for opafm +my @opafm_prereq = ( + "glibc", + "bash", + "rdma-core", + "systemd", + "libexpat1", + "libibmad5", + "libibumad3", + "libibverbs1", + "libopenssl1_0_0", + "libz1", +); +$comp_prereq_hash{'opafm_prereq'} = \@opafm_prereq; diff --git a/CommonInstall/comp_ofed.pl b/CommonInstall/comp_ofed.pl deleted file mode 100755 index 6bc7fa5e..00000000 --- a/CommonInstall/comp_ofed.pl +++ /dev/null @@ -1,5110 +0,0 @@ -#!/usr/bin/perl -# BEGIN_ICS_COPYRIGHT8 -# -# Copyright (c) 2015, Intel Corporation -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# END_ICS_COPYRIGHT8 - -# This file incorporates work covered by the following copyright and permission notice - -# -# Copyright (c) 2006 Mellanox Technologies. All rights reserved. -# -# This Software is licensed under one of the following licenses: -# -# 1) under the terms of the "Common Public License 1.0" a copy of which is -# available from the Open Source Initiative, see -# http://www.opensource.org/licenses/cpl.php. -# -# 2) under the terms of the "The BSD License" a copy of which is -# available from the Open Source Initiative, see -# http://www.opensource.org/licenses/bsd-license.php. -# -# 3) under the terms of the "GNU General Public License (GPL) Version 2" a -# copy of which is available from the Open Source Initiative, see -# http://www.opensource.org/licenses/gpl-license.php. -# -# Licensee has the right to choose one of the above licenses. -# -# Redistributions of source code must retain the above copyright -# notice and one of the license notices. -# -# Redistributions in binary form must reproduce both the above copyright -# notice, one of the license notices in the documentation -# and/or other materials provided with the distribution. - -use strict; -#use Term::ANSIColor; -#use Term::ANSIColor qw(:constants); -#use File::Basename; -#use Math::BigInt; - -# ========================================================================== -# OFED installation, includes opa_stack and OFED supplied ULPs - -my $OFED_CONFIG = "$OFED_CONFIG_DIR/openib.conf"; -my $default_prefix="/usr"; - -my $RPMS_SUBDIR = "RPMS"; # within ComponentInfo{'opa_stack'}{'SrcDir'} -my $SRPMS_SUBDIR = "SRPMS"; # within ComponentInfo{'opa_stack'}{'SrcDir'} - -# list of components which are part of OFED -# can be a superset or subset of @Components -# ofed_vnic -my @ofed_components = ( - "opa_stack", # Kernel drivers. - "intel_hfi", # HFI drivers - "ib_wfr_lite", # ib_wfr_lite kernel module - "ofed_mlx4", # MLX drivers - "opa_stack_dev", # dev libraries. - "ofed_ipoib", # ipoib module. - "ofed_ib_bonding", # ib_bonding rpm is separate from opa_stack. - "ofed_rds", # Now just tools. - "ofed_udapl", "ofed_udaplRest", - "ofed_srp", # SRP module. - "ofed_srpt", # SRP target module. - "ofed_iser", # iSCSI over RDMA - "mpi_selector", - "mvapich2", - "openmpi", - "gasnet", - "openshmem", - "ofed_mpisrc", # Source bundle for MPIs. - "mpiRest", # PGI, Intel mpi variants. - "ofed_iwarp", # iwarp support. - "opensm", # OFED SM. - "ofed_nfsrdma", # Enabling NFS over RDMA. - "ofed_debug", # must be last real component - "ibacm", # OFA IB communication manager assistant. -); - -# information about each component in ofed_components -# Fields: -# KernelRpms => kernel rpms for given component, in dependency order -# These are package packages which are kernel version specific and -# will have kernel uname -r in rpm package name. -# For a given distro a separate version of each of these rpms -# may exist per kernel. These are always architecture dependent -# UserRpms => user rpms for given component, in dependency order -# These are rpms which are not kernel specific. For a given -# distro a single version of each of these rpms will -# exist per distro/arch combination. Some of these may -# be architecture independent (noarch). -# Drivers => used so we can load ifs-kernel-updates rpm, then remove drivers for -# ULPs which are not desired. Ugly but a workaround for fact -# that ifs-kernel-updates has all the ULP drivers in it -# specifies drivers and subdirs which are within ifs-kernel-updates and -# specific to each component -# StartupScript => name of startup script which controls startup of this -# component -# StartupParams => list of parameter names in $OFED_CONFIG which control -# startup of this component (set to yes/no values) -# -# Note KernelRpms are always installed before UserRpms -my %ofed_comp_info = ( - 'opa_stack' => { - KernelRpms => [ "ifs-kernel-updates" ], # special case - UserRpms => [ "ifs-scripts", "ofed-scripts", - "libibverbs", "libibverbs-utils", - "libibumad", - "libibmad", - "libibcm", - "librdmacm", "librdmacm-utils", - #"libmthca", # Obsolete - "libipathverbs", - #"libehca", # Broken in 3.9.2. - #"libibcommon-compat", # Obsolete - #"libibumad-compat", # Obsolete - #"libibumad-compat-2", # Obsolete - #"libibmad-compat", # Obsolete - "ibacm", - #"infinipath-psm", -# TBD - in future OFED dependency on opensm-libs will go away and can -# move opensm-libs into opensm component - "opensm-libs", - "ofed-docs", -# TBD move these to a performance tests package - "perftest", "qperf", - ], - DebugRpms => [ "libibverbs-debuginfo", - #"libibcommon-debuginfo", # Obsolete - "libibumad-debuginfo", - "libibmad-debuginfo", - "libibcm-debuginfo", - "librdmacm-debuginfo", - "libmthca-debuginfo", - "libipathverbs-debuginfo", - #"libehca-debuginfo", # broken. - "qperf-debuginfo", - #"infinipath-psm-debuginfo", - ], - Drivers => "", # we don't need to list these here - # ib stack startup is controlled by - # ONBOOT and openibd script - # other parameters are left enabled so we can - # manually start the stack - # those include: RDMA_CM_LOAD, RDMA_UCM_LOAD, - # MTHCA_LOAD, IPATH_LOAD, QIB_LOAD, KCOPY_LOAD - # MLX4_EN_LOAD, UCM_LOAD - # and perhaps future ehca flags - StartupScript => "openibd", - StartupParams => [ "ONBOOT", "RDMA_UCM_LOAD" ], - }, - - 'intel_hfi' => { - KernelRpms => [ ], - UserRpms => [ "hfi1", "hfi1-devel", - "libhfi1verbs", "libhfi1verbs-devel", - "hfi-utils", - "hfi1-psm", - "hfi1-psm-devel", "hfi1-psm-compat", - "hfi1-diagtools-sw", - "hfi-firmware" - ], - DebugRpms => [ "hfi1_debuginfo", "hfi1-psm-devel-noship", - "hfi1-diagtools-sw-debuginfo" - ], - Drivers => "", - StartupScript => "openibd", - StartupParams => [ ], - }, - 'ib_wfr_lite' => { - KernelRpms => [ ], - UserRpms => [ "ib_wfr_lite", ], - DebugRpms => [ "ib_wfr_lite-debuginfo", ], - Drivers => "", - StartupScript => "openibd", - StartupParams => [ ], - }, - 'ofed_mlx4' => { - KernelRpms => [ ], - UserRpms => [ "libmlx4", - "libmlx4-devel", - ], - DebugRpms => [ "libmlx4-debuginfo", - ], - Drivers => "mlx4_ib drivers/infiniband/hw/mlx4 - mlx4_core drivers/net/mlx4", - StartupScript => "openibd", - # MWHEINZ FIXME StartupParams => [ "MLX4_LOAD" ], - StartupParams => [ ], - }, - 'opa_stack_dev' => { - KernelRpms => [ ], - UserRpms => [ "ibacm-devel", - "ifs-kernel-updates-devel", - "ifs-kernel-updates-scripts", - "libibverbs-devel", - "libibverbs-devel-static", - #"libibcommon-devel", "libibcommon-static", # Obsolete - "libibumad-devel", "libibumad-static", - "libibmad-devel", "libibmad-static", - "libibcm-devel", - "librdmacm-devel", - #"libmthca-devel-static", # Obsolete - "libipathverbs-devel", - #"libehca-devel-static", # broken - #"infinipath-psm-devel", -# TBD - in future OFED dependency on opensm-libs will go away and can -# move opensm-devel and opensm-static into opensm component and perhaps ibsim - "opensm-devel", "opensm-static", - "ibsim", - ], - DebugRpms => [ "ibsim-debuginfo", ], - Drivers => "", # none - StartupScript => "", - StartupParams => [ ], - }, - 'ofed_ipoib' => { - KernelRpms => [ ], - UserRpms => [ ], - DebugRpms => [ ], - Drivers => "ib_ipoib drivers/infiniband/ulp/ipoib", - StartupScript => "openibd", - StartupParams => [ "IPOIB_LOAD" ], - }, - 'ofed_ib_bonding' => { - # code assumes ib-bonding is only Rpm - KernelRpms => [ "ib-bonding", ], - UserRpms => [ ], - DebugRpms => [ "ib-bonding-debuginfo", ], - Drivers => "", # none from ifs-kernel-updates - StartupScript => "", - StartupParams => [ ], - }, - 'ofed_rds' => { - KernelRpms => [ ], - UserRpms => [ "rds-tools", "rds-devel", ], - DebugRpms => [ ], - Drivers => "rds net/rds", - StartupScript => "openibd", - StartupParams => [ "RDS_LOAD" ], - }, - 'ofed_udapl' => { - KernelRpms => [ ], - UserRpms => [ "dapl", "dapl-devel", - "dapl-devel-static", - "dapl-utils", - ], - DebugRpms => [ "dapl-debuginfo", ], - Drivers => "", # none - StartupScript => "", - StartupParams => [ ], - }, - # ofed install does not install these - # due to conflicts can't install both this and dapl-2 versions - 'ofed_udaplRest' => { - KernelRpms => [ ], - UserRpms => [ ], - DebugRpms => [ ], # leave in UserRpms not used - Drivers => "", # none - StartupScript => "", - StartupParams => [ ], - }, - 'ofed_srp' => { - KernelRpms => [ ], - UserRpms => [ "srptools", ], - Drivers => "ib_srp drivers/infiniband/ulp/srp", - DebugRpms => [ ], - StartupScript => "openibd", - #MWHEINZ DISABLED FOR WFR-LITE WORK StartupParams => [ "SRP_LOAD" ], - StartupParams => [ ], - }, - 'ofed_srpt' => { - KernelRpms => [ ], - UserRpms => [ ], - DebugRpms => [ ], - Drivers => "ib_srpt drivers/infiniband/ulp/srpt", - StartupScript => "openibd", - StartupParams => [ "SRPT_LOAD" ], - }, - 'ofed_iser' => { - # starting with 1.5.2rc3 iser no longer needed OFED iscsi - KernelRpms => [ ], - UserRpms => [ ], - DebugRpms => [ ], - Drivers => "ib_iser drivers/infiniband/ulp/iser", - StartupScript => "openibd", - #MWHEINZ FIXME StartupParams => [ "ISER_LOAD" ], - StartupParams => [ ], - }, - 'ofed_nfsrdma' => { - KernelRpms => [ ], - UserRpms => [ ], - DebugRpms => [ ], - Drivers => "auth_rpcgss net/sunrpc/auth_gss - rpcsec_gss_krb5 net/sunrpc/auth_gss - rpcsec_gss_spkm3 net/sunrpc/auth_gss - exportfs fs/exportfs - lockd fs/lockd - nfs_acl fs/nfs_common - nfsd fs/nfsd - nfs fs/nfs - sunrpc net/sunrpc - svcrdma net/sunrpc/xprtrdma - xprtrdma net/sunrpc/xprtrdma", - StartupScript => "", # not affected by OFED install - StartupParams => [ ], - }, - 'mpi_selector' => { - KernelRpms => [ ], - UserRpms => [ "mpi-selector" ], - DebugRpms => [ ], - Drivers => "", # none - StartupScript => "", - StartupParams => [ ], - }, - 'mvapich2' => { - KernelRpms => [ ], - UserRpms => [ "mvapich2_gcc", "mpitests_mvapich2_gcc" ], - DebugRpms => [ ], - Drivers => "", # none - StartupScript => "", - StartupParams => [ ], - }, - 'openmpi' => { - KernelRpms => [ ], - UserRpms => [ "openmpi_gcc_hfi", "mpitests_openmpi_gcc_hfi" , "openmpi_gcc", "mpitests_openmpi_gcc" ], - DebugRpms => [ ], - Drivers => "", # none - StartupScript => "", - StartupParams => [ ], - }, - 'gasnet' => { - KernelRpms => [ ], - UserRpms => [ "gasnet_gcc_hfi", "gasnet_gcc_hfi-devel" , "gasnet_gcc_hfi-tests" ], - DebugRpms => [ ], - Drivers => "", # none - StartupScript => "", - StartupParams => [ ], - }, - 'openshmem' => { - KernelRpms => [ ], - UserRpms => [ "openshmem_gcc_hfi", "openshmem-test-suite_gcc_hfi" ], - DebugRpms => [ ], - Drivers => "", # none - StartupScript => "", - StartupParams => [ ], - }, - 'ofed_mpisrc' => { # nothing to build, just copies srpms - KernelRpms => [ ], - UserRpms => [ ], - DebugRpms => [ ], - Drivers => "", # none - StartupScript => "", - StartupParams => [ ], - }, - 'mpiRest' => { # rest of MPI stuff which customer can build via do_build - # this is included here so we can uninstall - KernelRpms => [ ], - UserRpms => [ - "mvapich2_pgi", - "mvapich2_intel", "mvapich2_pathscale", - "openmpi_pgi", - "openmpi_intel", "openmpi_pathscale", - "mpitests_mvapich2_pgi", - "mpitests_mvapich2_intel", - "mpitests_mvapich2_pathscale", - "mpitests_openmpi_pgi", - "mpitests_openmpi_intel", - "mpitests_openmpi_pathscale", - ], - DebugRpms => [ ], - Drivers => "", # none - StartupScript => "", - StartupParams => [ ], - }, - 'ofed_iwarp' => { - KernelRpms => [ ], - UserRpms => [ "libcxgb3", - "libcxgb3-devel", - "libcxgb4", - "libcxgb4-devel", - "libnes", - "libnes-devel-static", - ], - DebugRpms => [ "libcxgb3-debuginfo", - "libcxgb4-debuginfo", - "libnes-debuginfo", - ], - Drivers => "iw_cxgb3 drivers/infiniband/hw/cxgb3 - cxgb3 drivers/net/cxgb3 - iw_cxgb4 drivers/infiniband/hw/cxgb4 - cxgb4 drivers/net/cxgb4 - iw_nes drivers/infiniband/hw/nes", - StartupScript => "openibd", - #MWHEINZ FIXME - #StartupParams => [ "CXGB3_LOAD", "CXGB4_LOAD", "NES_LOAD" ], - StartupParams => [ ], - }, - 'opensm' => { - KernelRpms => [ ], - UserRpms => [ "opensm", ], - DebugRpms => [ "opensm-debuginfo", ], - Drivers => "", # none - StartupScript => "opensmd", - StartupParams => [ ], - }, - 'ofed_debug' => { - KernelRpms => [ ], - UserRpms => [ ], - DebugRpms => [ ], # listed by comp above - Drivers => "", # none - StartupScript => "", - StartupParams => [ ], - }, - 'ibacm' => { - KernelRpms => [ ], - UserRpms => [ "ibacm", ], - DebugRpms => [ ], - Drivers => "", # none - StartupScript => "ibacm", - StartupParams => [ ], - }, -); - -# options for building ifs-kernel-updates srpm and what platforms they -# are each available for -my %ofed_kernel_ib_options = ( - # build option # arch & kernels supported on - # (see util_build.pl for more info on format) - # NOTE: the ifs-kernel-updates build takes no arguments right now. - # This list is now empty, but will probably get used as time goes on. -); - -# all kernel srpms -# these are in the order we must build/process them to meet basic dependencies -my @ofed_kernel_srpms = ( 'ifs-kernel-updates', 'ib-bonding' ); - -# all user space srpms -# these are in the order we must build/process them to meet basic dependencies -my @ofed_user_srpms = ( - "ifs-scripts", "ofed-scripts", "libibverbs", - #"libmthca", - "libmlx4", "libcxgb3", "libcxgb4", "libnes", "libipathverbs", #"libehca", - #"libibcommon", - "libibumad", "libibmad", "libibcm", "librdmacm", - "opensm", "ibsim", - #"libibcommon-compat", libibumad-compat", "libibumad-compat-2", libibmad-compat", -# "infinipath-psm", - "ibacm", "perftest", "mstflint", - "srptools", "rds-tools", - "infiniband-diags", "qperf", - "ofed-docs", "mpi-selector", "dapl", - "hfi1", "libhfi1verbs", "hfi-utils", "hfi1-psm", "hfi1-diagtools-sw", "hfi-firmware", - "ib_wfr_lite", - "mvapich2", "openmpi", "gasnet", "openshmem", "openshmem-test-suite" -); - -# rpms not presently automatically built -my @ofed_other_srpms = ( ); - -my @ofed_srpms = ( @ofed_kernel_srpms, @ofed_user_srpms, @ofed_other_srpms ); - -# This provides information for all kernel and user space srpms -# Fields: -# Available => indicate which platforms each srpm can be built for -# PostReq => after building each srpm, some of its generated rpms will -# need to be installed so that later srpms will build properly -# this lists all the rpms which may be needed by subsequent srpms -# Builds => list of kernel and user rpms built from each srpm -# caller must know if user/kernel rpm is expected -# PartOf => ofed_components this srpm is part of -# this is filled in at runtime based on ofed_comp_info -# cross referenced to Builds -# BuildPrereq => OS prereqs needed to build this srpm -# List in the form of "rpm version mode" for each. -# version is optional, default is "any" -# mode is optional, default is "any" -# Typically mode should be "user" for libraries -# See rpm_is_installed for more information about mode -my %ofed_srpm_info = ( - "ifs-kernel-updates" => { Available => "", - Builds => "ifs-kernel-updates ifs-kernel-updates-devel ifs-kernel-updates-scripts", - PostReq => "ifs-kernel-updates ifs-kernel-updates-devel ifs-kernel-updates-scripts", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "ib-bonding" => { Available => "", - Builds => "ib-bonding ib-bonding-debuginfo", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "hfi1" => { Available => "", - Builds => "hfi1 hfi1-devel", - PostReq => "hfi1-devel", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "hfi-utils" => { Available => "", - Builds => "hfi-utils", - PostReq => "hfi-utils", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "hfi1-psm" => { Available => "", - Builds => "hfi1-psm hfi1-psm-devel hfi1-psm-devel-noship hfi1-psm-compat", - PostReq => "hfi1-psm hfi1-psm-devel hfi1-psm-devel-noship hfi1-psm-compat", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "libhfi1verbs" => { Available => "", - Builds => "libhfi1verbs libhfi1verbs-devel", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "hfi1-diagtools-sw" => { Available => "", - Builds => "hfi1-diagtools-sw hfi1-diagtools-sw-debuginfo", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [ 'readline-devel', 'ncurses-devel', ], - }, - "hfi-firmware" => { Available => "", - Builds => "hfi-firmware", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "ib_wfr_lite" => { Available => "", - Builds => "ib_wfr_lite", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "ifs-scripts" => { Available => "", - Builds => "ifs-scripts", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "ofed-scripts" => { Available => "", - Builds => "ofed-scripts", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "libibverbs" => { Available => "", - Builds => "libibverbs libibverbs-devel libibverbs-devel-static libibverbs-utils libibverbs-debuginfo", - PostReq => "libibverbs libibverbs-devel libibverbs-devel-static", - PartOf => "", # filled in at runtime - BuildPrereq => [ 'gcc 4.1.2', 'glibc-devel any user', 'libstdc++ any user' ], - }, - "libmlx4" => { Available => "", - Builds => "libmlx4 libmlx4-devel libmlx4-debuginfo", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "libcxgb3" => { Available => "", - Builds => "libcxgb3 libcxgb3-devel libcxgb3-debuginfo", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "libcxgb4" => { Available => "", - Builds => "libcxgb4 libcxgb4-devel libcxgb4-debuginfo", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "libnes" => { Available => "", - Builds => "libnes libnes-devel-static libnes-debuginfo", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "libipathverbs" => { Available => "", - Builds => "libipathverbs libipathverbs-devel libipathverbs-debuginfo", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "libibumad" => { Available => "", - Builds => "libibumad libibumad-devel libibumad-static libibumad-debuginfo", - PostReq => "libibumad libibumad-devel", - PartOf => "", # filled in at runtime - BuildPrereq => [ 'libtool any user' ], - }, - "libibmad" => { Available => "", - Builds => "libibmad libibmad-devel libibmad-static libibmad-debuginfo", - PostReq => "libibmad libibmad-devel", - PartOf => "", # filled in at runtime - BuildPrereq => [ 'libtool any user' ], - }, - "libibumad-compat-2" => { Available => "", - Builds => "libibumad-compat-2", - PostReq => "libibumad-compat-2", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "libibcm" => { Available => "", - Builds => "libibcm libibcm-devel libibcm-debuginfo", - PostReq => "libibcm libibcm-devel", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "ibacm" => { Available => "", - Builds => "ibacm ibacm-devel", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "librdmacm" => { Available => "", - Builds => "librdmacm librdmacm-devel librdmacm-debuginfo librdmacm-utils", - PostReq => "librdmacm librdmacm-devel", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "opensm" => { Available => "", - Builds => "opensm-libs opensm opensm-devel opensm-static opensm-debuginfo", - PostReq => "opensm-libs opensm-devel", - PartOf => "", # filled in at runtime - BuildPrereq => [ 'bison', 'flex' ], - }, - "ibsim" => { Available => "", - Builds => "ibsim ibsim-debuginfo", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "dapl" => { Available => "", - Builds => "dapl dapl-devel dapl-devel-static dapl-utils dapl-debuginfo", - PostReq => "dapl dapl-devel dapl-devel-static", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "infinipath-psm" => { Available => "", - Builds => "infinipath-psm infinipath-psm-devel infinipath-psm-debuginfo", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "perftest" => { Available => "", - Builds => "perftest", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "srptools" => { Available => "", - Builds => "srptools", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "rds-tools" => { Available => "", - Builds => "rds-tools rds-devel", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "qperf" => { Available => "", - Builds => "qperf qperf-debuginfo", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "ofed-docs" => { Available => "", - Builds => "ofed-docs", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, - "mpi-selector" => { Available => "", - Builds => "mpi-selector", - PostReq => "mpi-selector", - PartOf => "", # filled in at runtime - BuildPrereq => [ 'tcsh' ], - }, - "mvapich2" => { Available => "", - # mpitests are built by do_mvapich2_build - Builds => "mvapich2_gcc mpitests_mvapich2_gcc", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [ 'libstdc++ any user', - 'libstdc++-devel any user', - 'sysfsutils any user', - 'g77', 'libgfortran any user' - ], - }, - "openmpi" => { Available => "", - # mpitests are built by do_openmpi_build - Builds => "openmpi_gcc_hfi mpitests_openmpi_gcc_hfi openmpi_gcc mpitests_openmpi_gcc", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [ 'libstdc++ any user', - 'libstdc++-devel any user', - 'g77', 'libgfortran any user', - 'binutils' - ], - }, - "gasnet" => { Available => "", - Builds => "gasnet_gcc_hfi gasnet_gcc_hfi-devel gasnet_gcc_hfi-tests", - PostReq => "gasnet_gcc_hfi gasnet_gcc_hfi-devel", - PartOf => "", # filled in at runtime - BuildPrereq => [ ], - }, - "openshmem" => { Available => "", - Builds => "openshmem_gcc_hfi", - PostReq => "openshmem_gcc_hfi", - PartOf => "", # filled in at runtime - BuildPrereq => [ ], - }, - "openshmem-test-suite" => { Available => "", - Builds => "openshmem-test-suite_gcc_hfi", - PostReq => "", - PartOf => "", # filled in at runtime - BuildPrereq => [], - }, -); - -# This provides information for all kernel and user space rpms -# This is built based on information in ofed_srpm_info and ofed_comp_info -# Fields: -# Available => boolean indicating if rpm can be available for this platform -# Parent => srpm which builds this rpm -# PartOf => space separate list of components this rpm is part of -# Mode => mode of rpm (kernel or user) -my %ofed_rpm_info = (); -my @ofed_rpms = (); - -# RPMs from previous versions of OFED -# as new RPMs are added above for present release, also add them here -my @ofed1_2_5_and_1_3_release_rpms = ( - "kernel-ib", - "ofed-scripts", - "libibverbs", "libibverbs-utils", "libibverbs-debuginfo", - "libibcommon", "libibcommon-debuginfo", - "libibumad", "libibumad-debuginfo", - "libibmad", "libibmad-debuginfo", - "libibcm", "libibcm-debuginfo", - "librdmacm", "librdmacm-utils", "librdmacm-debuginfo", - "libmlx4", "libmlx4-debuginfo", - "libmthca", "libmthca-debuginfo", - "libipathverbs", "libipathverbs-debuginfo", - "libehca", "libehca-debuginfo", - "libosmcomp", "libosmvendor", "libopensm", - "opensm-libs", - "mstflint", "tvflash", - "ofed-docs", - "perftest", "qperf", "qperf-debuginfo", - "ibutils", "infiniband-diags", "openib-diags", - - "kernel-ib-devel", - "libibverbs-devel", "libibverbs-devel-static", - "libibcommon-devel", "libibcommon-static", - "libibumad-devel", "libibumad-static", - "libibmad-devel", "libibmad-static", - "libibcm-devel", - "librdmacm-devel", - "libmlx4-devel-static", - "libmthca-devel-static", - "libipathverbs-devel", - "libehca-devel-static", - "opensm-devel", "opensm-static", - "libosmcomp-devel", "libosmvendor-devel", "libopensm-devel", - "ibsim", "ibsim-debuginfo", - "ib-bonding", "ib-bonding-debuginfo", "ipoibtools", - "rds-tools", - "dapl", "dapl-devel", "dapl-devel-static", - "dapl-utils", "dapl-debuginfo", - - # redhat renamed 1.2.5 OFED as follows: - "compat-dapl-devel-1.2.5", "compat-dapl-static-1.2.5", - "compat-dapl-1.2.5", - "dapl-static", "dapl-devel", "dapl", - "librdmacm-static", "libibcm-static", "libibverbs-static", - "libmlx4-static", "libmthca-static", "libipathverbs-static", - "libcxgb3-static", "libcxgb4-static", "libnes-static", - - "srptools", "ibvexdmtools", "qlvnictools", "mpi-selector", - "mvapich2", "mvapich2_gcc", "mvapich2_pgi", "mvapich2_intel", - "mvapich2_pathscale", - "openmpi", "openmpi_gcc", "openmpi_pgi", "openmpi_intel", - "openmpi_pathscale", - "mpitests", - "mpitests_mvapich2", - "mpitests_mvapich2_gcc", "mpitests_mvapich2_pgi", - "mpitests_mvapich2_intel", "mpitests_mvapich2_pathscale", - "mpitests_openmpi", - "mpitests_openmpi_gcc", "mpitests_openmpi_pgi", - "mpitests_openmpi_intel", "mpitests_openmpi_pathscale", - "libcxgb3", "libcxgb3-debuginfo", "libcxgb3-devel", - "libcxgb4", "libcxgb4-debuginfo", "libcxgb4-devel", - "libnes", "libnes-debuginfo", "libnes-devel-static", "libnes-devel", - "opensm", "opensm-debuginfo", -); -# new ones since 1.3 -my @ofed1_4_release_rpms = ( - "compat-dapl", "compat-dapl-devel", "compat-dapl-devel-static", - "compat-dapl-utils", "compat-dapl-debuginfo", - "libmlx4-devel", - # "tgt-generic", "tgt", - "scsi-target-utils", - "tvflash-debuginfo", - # a few which RHEL 5.3 chose to rename - "compat-dapl-static", "mpitests-mvapich2", "mpitests-openmpi", -); -my @ofed1_4_1_release_rpms = ( - "rnfs-utils", "rnfs-utils-debuginfo", -); -my @ofed1_5_2_release_rpms = ( - "ibacm", "infinipath-psm", "infinipath-psm-devel", -); -# A list of the OFED rpms that PathScale/QLogic may have distributed in previous -# releases. Omits rpms already listed above -my @qlgc_old_rpms = ( "rhel4-ofed-fixup", "qlogic-mpi-register", - "infinipath-kernel", "infinipath", "infinipath-libs", - "infinipath-doc", "infinipath-devel", - "mpi-frontend", "mpi-benchmark", "mpi-libs", "mpi-doc", "mpi-devel", - "tmi", "openmpi_pgi_qlc", "openmpi_pathscale_qlc", - "openmpi_intel_qlc", "openmpi_gcc_qlc", - "mvapich2_pgi_qlc", "mvapich2_pathscale_qlc", "mvapich2_intel_qlc", - "mvapich2_gcc_qlc", - "mpitests_openmpi_pgi_qlc", "mpitests_openmpi_pathscale_qlc", - "mpitests_openmpi_intel_qlc", "mpitests_openmpi_gcc_qlc", - "mpitests_mvapich2_pgi_qlc", "mpitests_mvapich2_pathscale_qlc", - "mpitests_mvapich2_intel_qlc", "mpitests_mvapich2_gcc_qlc", - "mpi-noship-tests", - ); -my @sles11_ofed_rpms = ( - # these are in SLES11 and are renames of some OFED 1.4 rpms - "libcxgb3-rdmav2", "libcxgb4-rdmav2", - "libmthca-rdmav2", "libmlx4-rdmav2", - "libcxgb3-rdmav2-devel", "libcxgb4-rdmav2-devel", - "libmthca-rdmav2-devel", "libmlx4-rdmav2-devel", - "libibcommon1", "libibumad1", "libibmad1", - "ofed-1.4.0", "ofed-1.4.1", "ofed-1.4.2", "ofed-1.5.2", - "ofa", - "libnes-rdmav2", "libamso-rdmav2", - "libnes-rdmav2-devel", "libamso-rdmav2-devel", - "ofed-doc", "ofed-kmp", "ofed-kmp-smp", "ofed-kmp-default", - "ofed-kmp-debug", "ofed-kmp-kdump", - "ofed-cxgb3-NIC-kmp-smp", "ofed-cxgb3-NIC-kmp-default", - "ofed-cxgb3-NIC-kmp-debug", "ofed-cxgb3-NIC-kmp-kdump", - "ofed-cxgb4-NIC-kmp-smp", "ofed-cxgb4-NIC-kmp-default", - "ofed-cxgb4-NIC-kmp-debug", "ofed-cxgb4-NIC-kmp-kdump", - # given naming convention, these MIGHT appear in SLES11 at some time - "libipathverbs-rdmav2", "libehca-rdmav2", - "libipathverbs-rdmav2-devel", "libehca-rdmav2-devel", - ); -my @prev_release_rpms = ( - @ofed1_2_5_and_1_3_release_rpms, @ofed1_4_release_rpms, - @ofed1_4_1_release_rpms, @ofed1_5_2_release_rpms, - @qlgc_old_rpms, @sles11_ofed_rpms, - "rdma-ofa-agent", "libibumad3", "libibmad5", - "mpich_mlx", "ibtsal", "openib", "opensm", "opensm-devel", "opensm-libs", - "mpi_osu", "mpi_ncsa", "thca", "ib-osm", "osm", "diags", "ibadm", "ib-diags", - "ibgdiag", "ibdiag", "ib-management", - "ib-verbs", "ib-ipoib", "ib-cm", "ib-sdp", "ib-dapl", "udapl", - "udapl-devel", "libdat", "libibat", "ib-kdapl", "ib-srp", - "ib-srp_target", "oiscsi-iser-support", "ofed-docs", "ofed-scripts" -); - -# RPMs from OFED in Redhat -my @redhat_rpms = ( - "udapl", "udapl-devel", "dapl", "dapl-devel", "libibcm", - "libibcm-devel", "libibcommon", "libibcommon-devel", - "libibmad", "libibmad-devel", "libibumad", "libibumad-devel", - "libibverbs", "libibverbs-devel", "libibverbs-utils", - "libipathverbs", "libipathverbs-devel", "libmthca", - "libmthca-devel", "libmlx4", "libmlx4-devel", - "libehca", "libehca-devel", - "libsdp", "librdmacm", "librdmacm-devel", "librdmacm-utils", - "openib", - "openib-diags", "openib-mstflint", "openib-perftest", - "openib-srptools", "openib-tvflash", - "openmpi", "openmpi-devel", "openmpi-libs", "openmpi11", - "opensm", "opensm-devel", "opensm-libs", "compat-opensm-libs", - "ibutils", "ibutils2", "ibutils-devel", "ibutils2-devel", "ibutils-libs", - "rdma", - "compat-openmpi", "compat-openmpi-psm", - "mvapich-psm", "mvapich-psm-devel", "mpitests-mvapich-psm", - "mvapich2-psm", "mvapich2-psm-devel", "mpitests-mvapich2-psm", - "openmpi-psm", "openmpi-psm-devel", "mpitests-openmpi-psm", -); - -# RPMs from OFED in SuSE -my @suse_rpms = ( - "libamso", "libamso-devel", "dapl2", "dapl2-devel", "mvapich2", - "mvapich2-devel", "mvapich-devel" -); - -my %ofed_autostart_save = (); -# ========================================================================== -# OFED opa_stack build in prep for installation - -# based on %ofed_srpm_info{}{'Available'} determine if the given SRPM is -# buildable and hence available on this CPU for $osver combination -# "user" and kernel rev values for mode are treated same -sub available_srpm($$$) -{ - my $srpm = shift(); - # $mode can be user or any other value, - # only used to select Available - my $mode = shift(); # "user" or kernel rev - my $osver = shift(); - my $avail = "Available"; - - DebugPrint("checking $srpm $mode $osver against '$ofed_srpm_info{$srpm}{$avail}'\n"); - return arch_kernel_is_allowed($osver, $ofed_srpm_info{$srpm}{$avail}); -} - -# initialize ofed_rpm_info based on specified osver for present system -sub init_ofed_rpm_info($) -{ - my $osver = shift(); - - %ofed_rpm_info = (); # start fresh - - # first get information based on all srpms - foreach my $srpm ( @ofed_srpms ) { - my @package_list = split /[[:space:]]+/, $ofed_srpm_info{$srpm}{'Builds'}; - foreach my $package ( @package_list ) { - next if ( "$package" eq '' ); # handle leading spaces - $ofed_rpm_info{$package}{'Available'} = available_srpm($srpm, "user", $osver); - $ofed_rpm_info{$package}{'Parent'} = "$srpm"; - } - } - - # now fill in PartOf and Mode based on all components - # allow for the case where a package could be part of more than 1 component - # however assume User vs Kernel is consistent - foreach my $comp ( @ofed_components ) { - foreach my $package ( @{ $ofed_comp_info{$comp}{'UserRpms'}} ) { - $ofed_rpm_info{$package}{'PartOf'} .= " $comp"; - $ofed_rpm_info{$package}{'Mode'} = "user"; - } - foreach my $package ( @{ $ofed_comp_info{$comp}{'KernelRpms'}} ) { - $ofed_rpm_info{$package}{'PartOf'} .= " $comp"; - $ofed_rpm_info{$package}{'Mode'} = "kernel"; - } - foreach my $package ( @{ $ofed_comp_info{$comp}{'DebugRpms'}} ) { - $ofed_rpm_info{$package}{'PartOf'} .= " ofed_debug"; - # this is the only debuginfo with kernel rev in its name - if ( "$package" eq "ib-bonding-debuginfo" ) { - $ofed_rpm_info{$package}{'Mode'} = "kernel"; - } else { - $ofed_rpm_info{$package}{'Mode'} = "user"; - } - } - } - @ofed_rpms = ( keys %ofed_rpm_info ); # list of all rpms - # fixup Available for those in "*Rest" but not in ofed_srpm_info{*}{Builds} - foreach my $package ( @ofed_rpms ) { - if ("$ofed_rpm_info{$package}{'Available'}" eq "" ) { - $ofed_rpm_info{$package}{'Available'}=0; - } - } - - # -debuginfo is not presently supported on SuSE or Centos - # also .rpmmacros overrides can disable debuginfo availability - if ( "$CUR_DISTRO_VENDOR" eq "SuSE" - || ! rpm_will_build_debuginfo()) { - foreach my $package ( @ofed_rpms ) { - if ($package =~ /-debuginfo/) { - $ofed_rpm_info{$package}{'Available'} = 0; - } - } - } - - # every package must be part of some component (could be a dummy component) - foreach my $package ( @ofed_rpms ) { - if ( "$ofed_rpm_info{$package}{'PartOf'}" eq "" ) { - LogPrint "$package: Not PartOf anything\n"; - } - } - - # build $ofed_srpm_info{}{PartOf} - foreach my $srpm ( @ofed_srpms ) { - $ofed_srpm_info{$srpm}{'PartOf'} = ''; - } - foreach my $package ( @ofed_rpms ) { - my @complist = split /[[:space:]]+/, $ofed_rpm_info{$package}{'PartOf'}; - my $srpm = $ofed_rpm_info{$package}{'Parent'}; - foreach my $comp ( @complist ) { - next if ( "$comp" eq '' ); # handle leading spaces - if ( " $ofed_srpm_info{$srpm}{'PartOf'} " !~ / $comp / ) { - $ofed_srpm_info{$srpm}{'PartOf'} .= " $comp"; - } - } - } - # fixup special case for ifs-kernel-updates, its part of all ofed comp w/ Drivers - my $srpm = $ofed_rpm_info{'ifs-kernel-updates'}{'Parent'}; - foreach my $comp ( @ofed_components ) { - if ("$ofed_comp_info{$comp}{'Drivers'}" ne "" ) { - if ( " $ofed_srpm_info{$srpm}{'PartOf'} " !~ / $comp / ) { - $ofed_srpm_info{$srpm}{'PartOf'} .= " $comp"; - } - } - } - - if (DebugPrintEnabled() ) { - # dump all SRPM info - DebugPrint "\nSRPMs:\n"; - foreach my $srpm ( @ofed_srpms ) { - DebugPrint("$srpm => Builds: '$ofed_srpm_info{$srpm}{'Builds'}'\n"); - DebugPrint(" PostReq: '$ofed_srpm_info{$srpm}{'PostReq'}'\n"); - DebugPrint(" Available: '$ofed_srpm_info{$srpm}{'Available'}'\n"); - DebugPrint(" Available: ".available_srpm($srpm, "user", $osver)." PartOf '$ofed_srpm_info{$srpm}{'PartOf'}'\n"); - } - - # dump all RPM info - DebugPrint "\nRPMs:\n"; - foreach my $package ( @ofed_rpms ) { - DebugPrint(" Mode: $ofed_rpm_info{$package}{'Mode'} PartOf: '$ofed_rpm_info{$package}{'PartOf'}'\n"); - } - - # dump all OFED component info - DebugPrint "\nOFA Components:\n"; - foreach my $comp ( @ofed_components ) { - DebugPrint(" $comp: KernelRpms: @{ $ofed_comp_info{$comp}{'KernelRpms'}}\n"); - DebugPrint(" UserRpms: @{ $ofed_comp_info{$comp}{'UserRpms'}}\n"); - DebugPrint(" DebugRpms: @{ $ofed_comp_info{$comp}{'DebugRpms'}}\n"); - DebugPrint(" Drivers: $ofed_comp_info{$comp}{'Drivers'}\n"); - DebugPrint(" StartupParams: @{ $ofed_comp_info{$comp}{'StartupParams'}}\n"); - } - DebugPrint "\n"; - } -} - -init_ofed_rpm_info($CUR_OS_VER); - -# ofed specific rpm functions, -# install available user or kernel rpms in list -# returns 1 if ifs-kernel-updates was installed -sub ofed_rpm_install_list($$$@) -{ - my $rpmdir = shift(); - my $osver = shift(); # OS version - my $skip_kernelib = shift(); # should ifs-kernel-updates be skipped if in package_list - my(@package_list) = @_; # package names - my $ret = 0; - - # user space RPM installs - foreach my $package ( @package_list ) - { - if ($ofed_rpm_info{$package}{'Available'} ) { - if ( "$ofed_rpm_info{$package}{'Mode'}" eq "kernel" ) { - if ( " $package " =~ / ifs-kernel-updates / ) { - next if ( $skip_kernelib); - $ret = 1; - } - rpm_install($rpmdir, $osver, $package); - } else { - rpm_install($rpmdir, "user", $package); - } - } - } - return $ret; -} - -# verify all rpms in list are installed -sub ofed_rpm_is_installed_list($@) -{ - my $osver = shift(); - my(@package_list) = @_; # package names - - foreach my $package ( @package_list ) - { - if ($ofed_rpm_info{$package}{'Available'} ) { - if ( "$ofed_rpm_info{$package}{'Mode'}" eq "kernel" ) { - if (! rpm_is_installed($package, $osver) ) { - return 0; - } - } else { - if (! rpm_is_installed($package, "user") ) { - return 0; - } - } - } - } - return 1; -} -# verify the rpmfiles exist for all the kernel RPMs listed -sub ofed_rpm_exists_list($$@) -{ - my $rpmdir = shift(); - my $mode = shift(); # "user" or kernel rev - my(@package_list) = @_; # package names - my $avail="Available"; - - foreach my $package ( @package_list ) - { - next if ( "$package" eq '' ); - if ($ofed_rpm_info{$package}{$avail} ) { - if (! rpm_exists($rpmdir, $mode, $package) ) { - return 0; - } - } - } - return 1; -} - -# returns install prefix for presently installed OFED -sub ofed_get_prefix() -{ - my $prefix = "/usr"; # default - return "$prefix"; -} - -# unfortunately OFED mpitests leaves empty directories on uninstall -# this can confuse IFS MPI tools because correct MPI to use -# cannot be identified. This remove such empty directories for all -# compilers in all possible prefixes for OFED -sub ofed_cleanup_mpitests() -{ - my $prefix = ofed_get_prefix(); - - if ( -e "$ROOT$prefix/mpi") { - system("cd '$ROOT$prefix/mpi'; rmdir -p */*/tests/* >/dev/null 2>&1"); - } - if ( -e "$ROOT/usr/mpi") { - system("cd $ROOT/usr/mpi; rmdir -p */*/tests/* >/dev/null 2>&1"); - } - if ( -e "$ROOT/$OFED_prefix/mpi") { - system("cd '$ROOT/$OFED_prefix/mpi'; rmdir -p */*/tests/* >/dev/null 2>&1"); - } -} - -# uninstall rpms which are in package_list and are not needed by -# any components in install_list -# all variations of the specified packages are uninstalled -sub ofed_rpm_uninstall_not_needed_list($$$$@) -{ - my $install_list = shift(); # components which will remain on system - my $uninstalling_list = shift(); # components which are being uninstalled - my $comp = shift(); # component being uninstalled - my $verbosity = shift(); - my(@package_list) = @_; # package names to consider for uninstall - -RPM: foreach my $package ( reverse(@package_list) ) { - my @install_list = split /[[:space:]]+/, $install_list; - foreach my $c ( @install_list ) { - next if ( "$c" eq '' ); # handling leading spaces - # see if package is part of a component we are interested in - if ( " @ofed_components " =~ / $c / - && " $ofed_rpm_info{$package}{'PartOf'} " =~ / $c / ) { - next RPM; # its still needed, leave it installed - } - } - # if we get here, package is not in any component we are interested in - if ( "$uninstalling_list" ne "" && "$comp" ne "" ) { - # we are doing an explicit uninstall, we must be careful - # about rpms which are part of more than 1 component - # uninstalling_list is in dependency order and is executed - # backwards, so once we get to processing the 1st component - # in uninstalling list which has this package, we know its - # safe to remove the package - my @uninstalling = split /[[:space:]]+/, $uninstalling_list; - foreach my $c ( @uninstalling ) { - next if ( "$c" eq '' ); # handling leading spaces - if ( " @ofed_components " =~ / $c / - && " $ofed_rpm_info{$package}{'PartOf'} " =~ / $c / ) { - # found 1st uninstalled component with package - if ("$c" ne "$comp") { - next RPM; # don't remove til get to $c's uninstall - } else { - last; # exit this loop and uninstall package - } - } - } - } - rpm_uninstall($package, "any", "", $verbosity); - } -} - - -# resolve filename within $srcdir/$SRPMS_SUBDIR -# and return filename relative to $srcdir -sub ofed_srpm_file($$) -{ - my $srcdir = shift(); - my $globname = shift(); # in $srcdir - - my $result = file_glob("$srcdir/$SRPMS_SUBDIR/$globname"); - $result =~ s|^$srcdir/||; - return $result; -} - -# indicate where OFED built RPMs can be found -sub ofed_rpms_dir() -{ - my $srcdir=$ComponentInfo{'opa_stack'}{'SrcDir'}; - # we purposely use a different directory than OFED, this way - # runs of OFED install or build scripts will not confuse the IFS - # wrapped install - ##return "$srcdir/$RPMS_SUBDIR/$RPM_DIST/"; - if (-d "$srcdir/$RPMS_SUBDIR/$CUR_DISTRO_VENDOR-$CUR_VENDOR_VER" - || ! -d "$srcdir/$RPMS_SUBDIR/$CUR_DISTRO_VENDOR-$CUR_VENDOR_MAJOR_VER") { - return "$srcdir/$RPMS_SUBDIR/$CUR_DISTRO_VENDOR-$CUR_VENDOR_VER"; - } else { - return "$srcdir/$RPMS_SUBDIR/$CUR_DISTRO_VENDOR-$CUR_VENDOR_MAJOR_VER"; - } -} - -# -# get prefix used when last built rpms -sub get_ofed_rpm_prefix($) -{ - my $rpmsdir = shift(); - - my $prefix_file = "$rpmsdir/Prefix"; - if ( ! -e "$prefix_file") { - return "invalid and unknown"; # unknown, play it safe and rebuild - } else { - my $prefix = `cat $prefix_file 2>/dev/null`; - chomp $prefix; - return $prefix; - } -} -sub save_ofed_rpm_prefix($$) -{ - my $rpmsdir = shift(); - my $prefix = shift(); - - my $prefix_file = "$rpmsdir/Prefix"; - system("mkdir -p $rpmsdir"); - system "echo $prefix > $prefix_file"; -} - -# verify if all rpms have been built from the given srpm -sub is_built_srpm($$) -{ - my $srpm = shift(); # srpm name prefix - my $mode = shift(); # ""user" or kernel rev - my $srcdir=$ComponentInfo{'opa_stack'}{'SrcDir'}; - my $rpmsdir = ofed_rpms_dir(); - - my @rpmlist = split /[[:space:]]+/, $ofed_srpm_info{$srpm}{'Builds'}; - return ( ofed_rpm_exists_list("$rpmsdir", $mode, @rpmlist) ); -} - -# see if srpm is part of any of the components being installed/reinstalled -sub need_srpm_for_install($$$$) -{ - my $srpm = shift(); # srpm name prefix - my $mode = shift(); # "user" or kernel rev - my $osver = shift(); - # add space at start and end so can search - # list with spaces around searched comp - my $installing_list = " ".shift()." "; # items being installed/reinstalled - - if (! available_srpm($srpm, $mode, $osver)) { - DebugPrint("$srpm $mode $osver not available\n"); - return 0; - } - - my @complist = split /[[:space:]]+/, $ofed_srpm_info{$srpm}{'PartOf'}; - foreach my $comp (@complist) { - next if ("$comp" eq ''); - DebugPrint("Check for $comp in ( $installing_list )\n"); - if ($installing_list =~ / $comp /) { - return 1; - } - } - return 0; -} - -sub need_build_srpm($$$$$$) -{ - my $srpm = shift(); # srpm name prefix - my $mode = shift(); # "user" or kernel rev - my $osver = shift(); # kernel rev - my $installing_list = shift(); # what items are being installed/reinstalled - my $force = shift(); # force a rebuild - my $prompt = shift(); # prompt (only used if ! $force) - - return ( need_srpm_for_install($srpm, $mode, $osver, $installing_list) - && ($force - || ! is_built_srpm($srpm, $mode) - || ($prompt && GetYesNo("Rebuild $srpm src RPM for $mode?", "n")))); -} - -sub need_install_rpm_list($$$@) -{ - my $osver = shift(); - my $force = shift(); - my $prompt = shift(); # prompt (only used if ! $force) - my(@package_list) = @_; # package names - my $found = 0; - my @available_list = (); - - foreach my $package ( @package_list ) { - if ($ofed_rpm_info{$package}{'Available'}) { - @available_list = ( @available_list, $package ); - } - } - if (! scalar(@available_list)) { - return 0; # nothing to consider for install - } - return ($force - || ! ofed_rpm_is_installed_list($osver, @available_list) - || ($prompt && GetYesNo("Reinstall @available_list for use during build?", "n"))); -} - -# move rpms from build tree (srcdir) to install tree (destdir) -sub ofed_move_rpms($$) -{ - my $srcdir = shift(); - my $destdir = shift(); - - system("mkdir -p $destdir"); - if (file_glob("$srcdir/$RPM_ARCH/*") ne "" ) { - system("mv $srcdir/$RPM_ARCH/* $destdir"); - } - if (file_glob("$srcdir/$RPM_KERNEL_ARCH/*") ne "" ) { - system("mv $srcdir/$RPM_KERNEL_ARCH/* $destdir"); - } - if (file_glob("$srcdir/noarch/*") ne "" ) { - system("mv $srcdir/noarch/* $destdir"); - } -} - -sub remove_unneeded_kernel_ib_drivers($); - -# install rpms which were PostReqs of previous srpms -sub ofed_install_needed_rpms($$$$$@) -{ - my $install_list = shift(); # total that will be installed when done - my $osver = shift(); # kernel rev - my $force_rpm = shift(); - my $prompt_rpm = shift(); - my $rpmsdir = shift(); - my @need_install = @_; - - if (need_install_rpm_list($osver, $force_rpm, $prompt_rpm, @need_install)) { - if (ofed_rpm_install_list("$rpmsdir", $osver, 0, @need_install)) { - remove_unneeded_kernel_ib_drivers($install_list); - } - } -} - -# Build RPM from source RPM -# build a specific SRPM -# this is heavily based on build_rpm in OFED install.pl -# main changes from cut and paste are marked with # IFS commands -# this has an srpm orientation and is only called when we really want to -# build the srpm -sub build_srpm($$$$$) -{ - my $srpm = shift(); # the srpm package name - my $TOPDIR = shift(); # top directory for build - my $BUILD_ROOT = shift(); # temp directory for build - my $prefix = shift(); # prefix for install path - my $resfileop = shift(); # append or replace build.res file - my $configure_options = ''; # ofed keeps per srpm, but only initializes here - my $srcdir=$ComponentInfo{'opa_stack'}{'SrcDir'}; - my $SRC_RPM = ofed_srpm_file($srcdir, "$srpm*.src.rpm"); - - if ("$srpm" eq "openshmem") { - $SRC_RPM = ofed_srpm_file($srcdir, "${srpm}_*.src.rpm"); - } - - # convert a few variables into the names used in OFED's build_rpm - my $parent = $srpm; - my $distro = "$CUR_DISTRO_VENDOR"; - my $dist_rpm_rel = $RPM_DIST_REL; - my $target_cpu = $RPM_ARCH; - my $optflags = rpm_query_param('optflags'); - my $mandir = rpm_query_param('_mandir'); - my $sysconfdir = rpm_query_param('_sysconfdir'); - my $arch = my_tolower($ARCH); - - my $cmd; - - my $ldflags; - my $cflags; - my $cppflags; - my $cxxflags; - my $fflags; - my $ldlibs; - my $openmpi_comp_env; - - my $pref_env; - if ($prefix ne $default_prefix) { - $pref_env .= " LD_LIBRARY_PATH=$prefix/lib64:$prefix/lib:\$LD_LIBRARY_PATH"; - if ($parent ne "mvapich2" and $parent ne "openmpi") { - $ldflags .= "$optflags -L$prefix/lib64 -L$prefix/lib"; - $cflags .= "$optflags -I$prefix/include"; - $cppflags .= "$optflags -I$prefix/include"; - } - } - - # IFS - OFED tested rpm_exist. We only get here if we - # want to build the rpm, so we force true and proceed - # (keeps indentation same as OFED install.pl for easier cut/paste) - if (1) { - if ($ldflags) { - $pref_env .= " LDFLAGS='$ldflags'"; - } - if ($cflags) { - $pref_env .= " CFLAGS='$cflags'"; - } - if ($cppflags) { - $pref_env .= " CPPFLAGS='$cppflags'"; - } - if ($cxxflags) { - $pref_env .= " CXXFLAGS='$cxxflags'"; - } - if ($fflags) { - $pref_env .= " FFLAGS='$fflags'"; - } - if ($ldlibs) { - $pref_env .= " LDLIBS='$ldlibs'"; - } - - $cmd = "$pref_env rpmbuild --rebuild --define '_topdir $TOPDIR'"; - $cmd .= " --define 'dist %{nil}'"; - $cmd .= " --target $target_cpu"; - # IFS - also set build_root so we can cleanup and avoid conflicts - $cmd .= " --buildroot '${BUILD_ROOT}'"; - $cmd .= " --define 'build_root ${BUILD_ROOT}'"; - - # Prefix should be defined per package - # IFS - dropped MPIs, built via do_X_build scripts instead - if ($parent eq "mpi-selector") { - $cmd .= " --define '_prefix $prefix'"; - $cmd .= " --define '_exec_prefix $prefix'"; - $cmd .= " --define '_sysconfdir $sysconfdir'"; - $cmd .= " --define '_usr $prefix'"; - $cmd .= " --define 'shell_startup_dir /etc/profile.d'"; - } - elsif ($parent =~ m/dapl/) { - # IFS - use rpm_query_param - my $def_doc_dir = rpm_query_param('_defaultdocdir'); - #my $def_doc_dir = `rpm --eval '%{_defaultdocdir}'`; - chomp $def_doc_dir; - $cmd .= " --define '_prefix $prefix'"; - $cmd .= " --define '_exec_prefix $prefix'"; - $cmd .= " --define '_sysconfdir $sysconfdir'"; - # IFS - the srpm name given includes the version for dapl - $cmd .= " --define '_defaultdocdir $def_doc_dir/$srpm'"; - #$cmd .= " --define '_defaultdocdir $def_doc_dir/$main_packages{$parent}{'name'}-$main_packages{$parent}{'version'}'"; - $cmd .= " --define '_usr $prefix'"; - } -# TBD - odd that prefix, exec_prefix, sysconfdir and usr not defined -# IFS - may want to add these 4 just to be safe, they are not in OFED -# $cmd .= " --define '_prefix $prefix'"; -# $cmd .= " --define '_exec_prefix $prefix'"; -# $cmd .= " --define '_sysconfdir $sysconfdir'"; -# $cmd .= " --define '_usr $prefix'"; - else { - $cmd .= " --define '_prefix $prefix'"; - $cmd .= " --define '_exec_prefix $prefix'"; - $cmd .= " --define '_sysconfdir $sysconfdir'"; - $cmd .= " --define '_usr $prefix'"; - } - - if ($parent eq "librdmacm") { - # IFS - keep configure_options as a local, ibacm always installed - #if ( $packages_info{'ibacm'}{'selected'}) { - if ( $ofed_rpm_info{'ibacm'}{'Available'}) { - $configure_options .= " --with-ib_acm"; - } - } - - # IFS - keep configure_options as a local - if ($configure_options or $OFED_user_configure_options) { - $cmd .= " --define 'configure_options $configure_options $OFED_user_configure_options'"; - } - - # IFS - use SRC_RPM (computed above) instead of srpmpath_for_distro -# $cmd .= " $main_packages{$parent}{'srpmpath'}"; - $cmd .= " $SRC_RPM"; - - if ("$srpm" eq "hfi1") { - $cmd .= " --define 'require_kver 3.12.18-wfr+'"; - } - - if ("$srpm" eq "ib_wfr_lite") { - $cmd .= " --define 'require_kver 3.12.18-wfr+'"; - } - - if ("$srpm" eq "gasnet") { - $cmd .= " --define '_name gasnet_openmpi_hfi'"; - $cmd .= " --define '_prefix /usr/shmem/gcc/gasnet-1.24.0-openmpi-hfi'"; - $cmd .= " --define '_name gasnet_gcc_hfi'"; - $cmd .= " --define 'spawner mpi'"; - $cmd .= " --define 'mpi_prefix /usr/mpi/gcc/openmpi-1.10.0-hfi'"; - } - - if ("$srpm" eq "openshmem") { - $cmd .= " --define '_name openshmem_gcc_hfi'"; - $cmd .= " --define '_prefix /usr/shmem/gcc/openshmem-1.0h-hfi'"; - $cmd .= " --define 'gasnet_prefix /usr/shmem/gcc/gasnet-1.24.0-openmpi-hfi'"; - $cmd .= " --define 'configargs --with-gasnet-threnv=seq'"; - } - - if ("$srpm" eq "openshmem-test-suite") { - $cmd .= " --define '_name openshmem-test-suite_gcc_hfi'"; - $cmd .= " --define '_prefix /usr/shmem/gcc/openshmem-1.0h-hfi'"; - $cmd .= " --define 'openshmem_prefix /usr/shmem/gcc/openshmem-1.0h-hfi'"; - } - return run_build("$srcdir $SRC_RPM $RPM_ARCH", "$srcdir", $cmd, "$resfileop"); - } - # NOTREACHED -} - -# build all OFED components specified in installing_list -# if already built, prompt user for option to build -sub build_ofed($$$$$$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - my $K_VER = shift(); # osver - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - - my $prompt_srpm = 0; # prompt per SRPM - my $prompt_rpm = 0; # prompt per RPM - my $force_srpm = $force; # force SRPM rebuild - my $force_kernel_srpm = ("$OFED_kernel_configure_options" ne ""); - my $force_user_srpm = ("$OFED_user_configure_options" ne ""); - my $force_rpm = $force; # force dependent RPM reinstall - my $rpmsdir = ofed_rpms_dir(); - - my $prefix=$OFED_prefix; - if ("$prefix" ne get_ofed_rpm_prefix($rpmsdir)) { - $force_kernel_srpm = 1; - $force_user_srpm = 1; - } - - if (! $force && ! $Default_Prompt && ! ($force_user_srpm && $force_kernel_srpm)) { - my $choice = GetChoice("Rebuild OFA SRPMs (a=all, p=prompt per SRPM, n=only as needed?)", "n", ("a", "p", "n")); - if ("$choice" eq "a") { - $force_srpm=1; - } elsif ("$choice" eq "p") { - $prompt_srpm=1; - } elsif ("$choice" eq "n") { - $prompt_srpm=0; - } - } - # we base our decision on status of opa_stack. Possible risk if - # opa_stack is partially upgraded and was interrupted. - if (! comp_is_uptodate('opa_stack') || $force_srpm || $force_user_srpm || $force_kernel_srpm) { - $force_rpm = 1; - } elsif (! $Default_Prompt) { - my $choice = GetChoice("Reinstall OFA dependent RPMs (a=all, p=prompt per RPM, n=only as needed?)", "n", ("a", "p", "n")); - if ("$choice" eq "a") { - $force_rpm=1; - } elsif ("$choice" eq "p") { - $prompt_rpm=1; - } elsif ("$choice" eq "n") { - $prompt_rpm=0; - } - } - - # ------------------------------------------------------------------------- - # do all rebuild prompting first so user doesn't have to wait 5 minutes - # between prompts - my $build_compat_rdma = need_build_srpm("ifs-kernel-updates", "$K_VER", "$K_VER", - $installing_list, - $force_srpm || $force_kernel_srpm || $OFED_debug, - $prompt_srpm); - - my $build_ib_bonding = need_build_srpm("ib-bonding", $K_VER, "$K_VER", - $installing_list, - $force_srpm||$force_kernel_srpm,$prompt_srpm); - - my $need_build = ($build_compat_rdma || $build_ib_bonding); - my %build_user_srpms = (); - - foreach my $srpm ( @ofed_user_srpms ) { - VerbosePrint("check if need to build $srpm\n"); - $build_user_srpms{"${srpm}_build_user"} = 0; - - # mpitests is built as part of mvapich, openmpi and mvapich2 - next if ( "$srpm" eq "mpitests" ); - - $build_user_srpms{"${srpm}_build_user"} = - need_build_srpm($srpm, "user", "$K_VER", $installing_list, - $force_srpm || $force_user_srpm,$prompt_srpm); - $need_build |= $build_user_srpms{"${srpm}_build_user"}; - } - - if (! $need_build) { - return 0; # success - } - - # ------------------------------------------------------------------------- - # check OS dependencies for all srpms which we will build - my $dep_error = 0; - - NormalPrint "Checking OS Dependencies needed for builds...\n"; - - if ($build_compat_rdma) - { - VerbosePrint("check dependencies for ifs-kernel-updates\n"); - if (check_kbuild_dependencies($K_VER, "ifs-kernel-updates")) { - DebugPrint "ifs-kernel-updates kbuild dependency failure\n"; - $dep_error = 1; - } - if (check_rpmbuild_dependencies("ifs-kernel-updates")) { - DebugPrint "ifs-kernel-updates rpmbuild dependency failure\n"; - $dep_error = 1; - } - } - if ($build_ib_bonding) - { - VerbosePrint("check dependencies for ib-bonding\n"); - if (check_kbuild_dependencies($K_VER, "ib-bonding")) { - DebugPrint "ib-bonding kbuild dependency failure\n"; - $dep_error = 1; - } - if (check_rpmbuild_dependencies("ib-bonding")) { - DebugPrint "ib-bonding rpmbuild dependency failure\n"; - $dep_error = 1; - } - } - foreach my $srpm ( @ofed_user_srpms ) { - # mpitests is built as part of mvapich, openmpi and mvapich2 - next if ( "$srpm" eq "mpitests" ); - - my $build_user = $build_user_srpms{"${srpm}_build_user"}; - - next if ( ! $build_user ); - - VerbosePrint("check dependencies for $srpm\n"); - - if (check_rpmbuild_dependencies($srpm)) { - DebugPrint "$srpm rpmbuild dependency failure\n"; - $dep_error = 1; - } - if ($build_user) { - DebugPrint "Check $srpm user build prereqs\n"; - if (check_build_dependencies($srpm)) { - $dep_error = 1; - } - if (rpm_check_build_os_prereqs("any", $srpm, - @{ $ofed_srpm_info{$srpm}{'BuildPrereq'}})) { - DebugPrint "$srpm prereqs dependency failure\n"; - $dep_error = 1; - } - } - if ("$srpm" eq "rnfs-utils" ) { - my @reqs = ('krb5-devel any user'); - if ("$CUR_DISTRO_VENDOR" eq 'redhat' || - "$CUR_DISTRO_VENDOR" eq 'fedora') { - @reqs = ( @reqs, 'krb5-libs any user', - 'openldap-devel any user'); - # RHEL6 and later have removed libevent and nfs-utils-lib - if ("$CUR_VENDOR_VER" eq 'ES5' || "$CUR_VENDOR_VER" eq 'ES4') { - @reqs = ( @reqs, 'libevent-devel any user', - 'nfs-utils-lib-devel any user'); - } - } else { - @reqs = ( @reqs, 'krb5 any user', - 'openldap2-devel any user', - 'cyrus-sasl-devel any user'); - } - if ("$CUR_DISTRO_VENDOR" eq 'SuSE') { - if ($K_VER =~ m/2\.6\.2[6-7]/ ) { - @reqs = ( @reqs, 'libblkid-devel any user'); - } else { - @reqs = ( @reqs, 'e2fsprogs-devel any user'); - } - if ("$CUR_VENDOR_VER" eq 'ES11') { - @reqs = ( @reqs, 'libevent-devel any user', - 'nfsidmap-devel any user', - 'libopenssl-devel any user'); - } - } - if (rpm_check_build_os_prereqs("any", "$srpm for $ComponentInfo{'ofed_nfsrdma'}{'Name'}", (@reqs))) { - $dep_error = 1; - } - } - } - if ($dep_error) { - NormalPrint "ERROR - unable to perform builds due to need for additional OS rpms\n"; - return 1; # failure - } - - # ------------------------------------------------------------------------- - # perform the builds - my $srcdir=$ComponentInfo{'opa_stack'}{'SrcDir'}; - - my $must_force_rpm = 0; # set if we rebuild something so force updates - my @need_install = ( ); # keep track of PostReqs not yet installed - my @installed = (); # rpms we installed to facilitate builds - - if ("$prefix" ne get_ofed_rpm_prefix($rpmsdir)) { - system("rm -rf $rpmsdir"); # get rid of stuff with old prefix - save_ofed_rpm_prefix($rpmsdir, $prefix); - } - - # use a different directory for BUILD_ROOT to limit conflict with OFED - if ("$build_temp" eq "" ) { - $build_temp = "/var/tmp/IntelOPA-OFED"; - } - my $BUILD_ROOT="$build_temp/build"; - my $RPM_DIR="$build_temp/OFEDRPMS"; - my $mandir = rpm_query_param("_mandir"); - my $resfileop = "replace"; # replace for 1st build, append for rest - - system("rm -rf ${build_temp}"); - - # use a different directory for BUILD_ROOT to limit conflict with OFED - if (0 != system("mkdir -p $BUILD_ROOT $RPM_DIR/BUILD $RPM_DIR/RPMS $RPM_DIR/SOURCES $RPM_DIR/SPECS $RPM_DIR/SRPMS")) { - NormalPrint "ERROR - mkdir -p $BUILD_ROOT $RPM_DIR/BUILD $RPM_DIR/RPMS $RPM_DIR/SOURCES $RPM_DIR/SPECS $RPM_DIR/SRPMS FAILED\n"; - return 1; # failure - } - - my $rpm_os_version=rpm_tr_os_version($K_VER); - - # OFED has all the ULPs in a single ifs-kernel-updates RPM. We build that - # RPM here from the ifs-kernel-updates SRPM with all ULPs included. - # Later during install we remove ULPs not desired after installing - # the ifs-kernel-updates RPM - if ($build_compat_rdma) - { - my $OFA_KERNEL_SRC_RPM=ofed_srpm_file($srcdir,"ifs-kernel-updates*.src.rpm"); - my $K_SRC = "/lib/modules/$K_VER/build"; - my $configure_options_kernel; - my $cok_macro; - $configure_options_kernel = get_build_options($K_VER, %ofed_kernel_ib_options); - if ( $OFED_debug ) { - # TBD --with-memtrack - #$configure_options_kernel .= " --with-memtrack"; - } - - VerbosePrint("OS specific kernel configure options: '$configure_options_kernel'\n"); - - if ($configure_options_kernel != "") { - $cok_macro=" --define 'configure_options ${configure_options_kernel} $OFED_kernel_configure_options'"; - } - if (0 != run_build("$srcdir $OFA_KERNEL_SRC_RPM $RPM_KERNEL_ARCH $K_VER", "$srcdir", - "rpmbuild --rebuild --define '_topdir ${RPM_DIR}'" - . " --target $RPM_KERNEL_ARCH" - . " --define '_prefix ${prefix}'" - . " --buildroot '${BUILD_ROOT}'" - . " --define 'build_root ${BUILD_ROOT}'" - . $cok_macro - . " --define 'KVERSION ${K_VER}'" - . " --define 'KSRC ${K_SRC}'" - . " --define 'build_kernel_ib 1'" - . " --define 'build_kernel_ib_devel 1'" - . " --define 'network_dir ${NETWORK_CONF_DIR}'" - . " --define '__arch_install_post %{nil}'" - . " --define '_release $rpm_os_version'" - . " ${OFA_KERNEL_SRC_RPM}", - "$resfileop" - )) { - return 1; # failure - } - $must_force_rpm=1; - $resfileop = "append"; - ofed_move_rpms("$RPM_DIR/$RPMS_SUBDIR", "$rpmsdir"); - } - @need_install = ( @need_install, split /[[:space:]]+/, $ofed_srpm_info{'ifs-kernel-updates'}{'PostReq'}); - - if ($build_ib_bonding) - { - my $IB_BONDING_SRC_RPM=ofed_srpm_file($srcdir,"ib-bonding*.src.rpm"); - - # OFED_kernel_configure_options not applicable to ib-bonding - if (0 != run_build("$srcdir $IB_BONDING_SRC_RPM $RPM_KERNEL_ARCH $K_VER", "$srcdir", - "rpmbuild --rebuild --define '_topdir ${RPM_DIR}'" - . " --target $RPM_KERNEL_ARCH" - . " --define '_prefix ${prefix}'" - . " --buildroot '${BUILD_ROOT}'" - . " --define 'build_root ${BUILD_ROOT}'" - . " --define 'KVERSION ${K_VER}'" - . " --define '_release ${rpm_os_version}'" - . " --define '__arch_install_post %{nil}'" - . " ${IB_BONDING_SRC_RPM}", - "$resfileop" - )) { - return 1; # failure - } - $resfileop = "append"; - ofed_move_rpms("$RPM_DIR/$RPMS_SUBDIR", "$rpmsdir"); - $must_force_rpm=1; - } - @need_install = ( @need_install, split /[[:space:]]+/, $ofed_srpm_info{'ib-bonding'}{'PostReq'}); - - foreach my $srpm ( @ofed_user_srpms ) { - VerbosePrint("process $srpm\n"); - - # mpitests is built as part of mvapich, openmpi and mvapich2 - next if ( "$srpm" eq "mpitests" ); - - my $build_user = $build_user_srpms{"${srpm}_build_user"}; - if ($build_user) { - # load rpms which are were PostReqs from previous srpm builds - ofed_install_needed_rpms($install_list, $K_VER, $force_rpm||$must_force_rpm, $prompt_rpm, $rpmsdir, @need_install); - @installed = ( @installed, @need_install); - @need_install = (); - $must_force_rpm=0; - - # build it - if ("$srpm" eq "mvapich2" ) { - if (0 != run_build("mvapich2_gcc and mpitests_mvapich2_gcc", "$srcdir", "STACK_PREFIX='$prefix' BUILD_DIR='$build_temp' MPICH_PREFIX= CONFIG_OPTIONS='$OFED_user_configure_options' INSTALL_ROOT='$ROOT' ./do_mvapich2_build -d -i gcc", $resfileop)) { - return 1; # failure - } - # build already installed mvapich2_gcc - @installed = ( @installed, split /[[:space:]]+/, 'mvapich2_gcc'); - $resfileop = "append"; - $must_force_rpm=1; - } elsif ("$srpm" eq "openmpi" ) { - if (0 != run_build("openmpi_gcc and mpitests_openmpi_gcc", "$srcdir", "STACK_PREFIX='$prefix' BUILD_DIR='$build_temp' MPICH_PREFIX= CONFIG_OPTIONS='$OFED_user_configure_options' INSTALL_ROOT='$ROOT' ./do_openmpi_build -d -i gcc", $resfileop)) { - return 1; # failure - } - # build already installed openmpi_gcc - @installed = ( @installed, split /[[:space:]]+/, 'openmpi_gcc'); - $resfileop = "append"; - $must_force_rpm=1; - - ofed_move_rpms("$RPM_DIR/$RPMS_SUBDIR", "$rpmsdir"); - - if (0 != run_build("openmpi_gcc_hfi and mpitests_openmpi_gcc_hfi", "$srcdir", "STACK_PREFIX='$prefix' BUILD_DIR='$build_temp' MPICH_PREFIX= CONFIG_OPTIONS='$OFED_user_configure_options' INSTALL_ROOT='$ROOT' ./do_openmpi_build -d -i -O gcc", $resfileop)) { - return 1; # failure - } - # build already installed openmpi_gcc - @installed = ( @installed, split /[[:space:]]+/, 'openmpi_gcc_hfi'); - $resfileop = "append"; - $must_force_rpm=1; - } else { # all non-MPI user RPMs - if ($build_user) { - if (0 != build_srpm($srpm, $RPM_DIR, $BUILD_ROOT, $prefix, $resfileop)) { - return 1; # failure - } - $resfileop = "append"; - } - $resfileop = "append"; - @need_install = ( @need_install, split /[[:space:]]+/, $ofed_srpm_info{$srpm}{'PostReq'}); - $must_force_rpm=1; - } - ofed_move_rpms("$RPM_DIR/$RPMS_SUBDIR", "$rpmsdir"); - } else { - @need_install = ( @need_install, split /[[:space:]]+/, $ofed_srpm_info{$srpm}{'PostReq'}); - } - } - - # get rid of rpms we installed to enable builds but are not desired to stay - # eg. uninstall rpms which were installed but are not part of install_list - ofed_rpm_uninstall_not_needed_list($install_list, "", "", "verbose", @installed); - - if (! $debug) { - system("rm -rf ${build_temp}"); - } else { - LogPrint "Build remnants left in $BUILD_ROOT and $RPM_DIR\n"; - } - - return 0; # success -} - -# forward declarations -sub installed_ofed_opa_stack(); -sub uninstall_old_stacks($); - -# track if install_kernel_ib function was used so we only install -# ifs-kernel-updates once in a given "Perform" of install menu -my $install_kernel_ib_was_run = 0; - -# return 0 on success, != 0 otherwise -sub uninstall_old_ofed_rpms($$$) -{ - my $mode = shift(); # "user" or kernel rev - # "any"- checks if any variation of package is installed - my $verbosity = shift(); - my $message = shift(); - - my $ret = 0; # assume success - my @packages = (); - - if ("$message" eq "" ) { - $message = "previous OFA"; - } - NormalPrint "\nUninstalling $message RPMs\n"; - - # SLES11 includes an old version of OpenMPI that other packages may depend on, but - # which must be removed to prevent conflicts with the new version that we are installing. - #if ("$CUR_DISTRO_VENDOR" eq 'SuSE' && "$CUR_VENDOR_VER" eq 'ES11') { - # DebugPrint("Forcing Uninstall of SLES11 OpenMPI\n"); - # if (rpm_uninstall_matches("SLES11 OpenMPI", "openmpi-1.2.8", "", "--nodeps")) { - # NormalPrint "Unable to uninstall existing openmpi installation.\n"; - # } - #} - # SLES11 includes an old version of OpenMPI that other packages may depend on, but needs to be unselected in mpi-selector - if ("$CUR_DISTRO_VENDOR" eq 'SuSE' && "$CUR_VENDOR_VER" eq 'ES11' && $mode eq 'any') { - LogPrint "mpi-selector --unset --system >/dev/null 2>/dev/null\n"; - system("mpi-selector --unset --system >/dev/null 2>/dev/null"); - LogPrint "mpi-selector --unset --user >/dev/null 2>/dev/null\n"; - system("mpi-selector --unset --user >/dev/null 2>/dev/null"); - } - - # uninstall all present version OFED rpms, just to be safe - foreach my $i ( reverse(@ofed_components) ) { - @packages = (@packages, @{ $ofed_comp_info{$i}{'DebugRpms'}}); - @packages = (@packages, @{ $ofed_comp_info{$i}{'UserRpms'}}); - @packages = (@packages, @{ $ofed_comp_info{$i}{'KernelRpms'}}); - } - # uninstall RPMs from older versions of OFED - @packages = (@packages, @prev_release_rpms); - @packages = (@packages, @redhat_rpms); - @packages = (@packages, @suse_rpms); - # other potential RPMs for ofed - #my @other_ofed_rpms = `rpm -qa 2> /dev/null | grep ofed`; - #@packages = (@packages, @other_ofed_rpms); - - # workaround LAM and other MPIs usng mpi-selector - # we uninstall mpi-selector separately and ignore failures for its uninstall - my @filtered_packages = (); - my @rest_packages = (); - foreach my $i ( @packages ) { - if (scalar(grep /^$i$/, (@filtered_packages, @rest_packages)) > 0) { - # skip, already in list - } elsif ( "$i" eq "mpi-selector" ) { - @rest_packages = (@rest_packages, "$i"); - } elsif ("$i" eq "openmpi") { - if ("$CUR_DISTRO_VENDOR" eq 'SuSE' && "$CUR_VENDOR_VER" eq 'ES11') { - # SLES11 openmpi is used by boost - # keep openmpi for now - #@filtered_packages = (@filtered_packages, "boost-devel", "libboost_mpi1_36_0", "$i"); - # try to remove it, but ignore errors - @rest_packages = (@rest_packages, "$i"); - } else { - @filtered_packages = (@filtered_packages, "$i"); - } - } elsif ( ("$i" eq "ib-bonding" || "$i" eq "ib-bonding-debuginfo") - && ! $ofed_rpm_info{$i}{'Available'}) { - # skip, might be included with distro - } else { - @filtered_packages = (@filtered_packages, "$i"); - } - } - - $ret ||= rpm_uninstall_all_list($mode, $verbosity, @filtered_packages); - - # ignore errors uninstalling mpi-selector - if (scalar(@rest_packages) != 0) { - if (rpm_uninstall_all_list($mode, $verbosity, @rest_packages) && ! $ret) { - NormalPrint "The previous errors can be ignored\n"; - } - } - - ofed_cleanup_mpitests(); - - if ( $ret ) { - NormalPrint "Unable to uninstall $message RPMs\n"; - } - return $ret; -} - -# The QuickSilver version of SDP can leave sunrpc in a patched state -# in which case nfs will not load because it depends on QuickSilver SDP module -sub cleanup_iba_sdp() -{ - # only care about 2.6 kernels (.ko modules, not .o) - if ( -e "$ROOT/lib/modules/$CUR_OS_VER/kernel/net/sunrpc/sunrpc.ko_orig" ) { - my $res=system("cmp -s $ROOT/lib/modules/$CUR_OS_VER/kernel/net/sunrpc/sunrpc.ko_sdp $ROOT/lib/modules/$CUR_OS_VER/kernel/net/sunrpc/sunrpc.ko"); - if ( $res == 0) { - NormalPrint "Undoing QuickSilver SDP NFS hooks\n"; - # Quicksilver sdp version is the active version, restore orig - my $cmd="cp $ROOT/lib/modules/$CUR_OS_VER/kernel/net/sunrpc/sunrpc.ko_orig $ROOT/lib/modules/$CUR_OS_VER/kernel/net/sunrpc/sunrpc.ko"; - LogPrint "$cmd\n"; - if (0 != system("$cmd")) { - NormalPrint "ERROR - Failed to $cmd\n"; - } - } - } -} - -# remove any old stacks or old versions of the stack -# this is necessary before doing builds to ensure we don't use old dependent -# rpms -sub uninstall_prev_versions() -{ - cleanup_iba_sdp(); - if (! installed_ofed_opa_stack) { - if (0 != uninstall_old_stacks(1)) { - return 1; - } - } elsif (! comp_is_uptodate('opa_stack')) { # all ofed_comp same version - if (0 != uninstall_old_ofed_rpms("any", "silent", "previous OFED")) { - return 1; - } - } - return 0; -} - -sub media_version_ofed() -{ - # all OFED components at same version as opa_stack - my $srcdir=$ComponentInfo{'opa_stack'}{'SrcDir'}; - return `cat "$srcdir/Version"`; -} - -sub ofed_save_autostart() -{ - foreach my $comp ( @ofed_components ) { - if ($ComponentInfo{$comp}{'HasStart'} - && $ofed_comp_info{$comp}{'StartupScript'} ne "") { - $ofed_autostart_save{$comp} = comp_IsAutostart2($comp); - } else { - $ofed_autostart_save{$comp} = 0; - } - } -} - -sub ofed_restore_autostart($) -{ - my $comp = shift(); - - if ( $ofed_autostart_save{$comp} ) { - comp_enable_autostart2($comp, 1); - } else { - if ($ComponentInfo{$comp}{'HasStart'} - && $ofed_comp_info{$comp}{'StartupScript'} ne "") { - comp_disable_autostart2($comp, 1); - } - } -} - -# makes sure needed OFED components are already built, builts/rebuilds as needed -# called for every ofed component's preinstall, noop for all but -# first OFED component in installing_list -# also available for use by srp to facilitate them getting -# built within ofed context -sub preinstall_ofed($$$) -{ - my $comp = shift(); # calling component - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - # make sure flag cleared so will install this if part of an installed comp - $install_kernel_ib_was_run = 0; - - # ignore non-ofed components at start of installing_list - my @installing = split /[[:space:]]+/, $installing_list; - while (scalar(@installing) != 0 - && ("$installing[0]" eq "" - || " @ofed_components " !~ / $installing[0] /)) { - shift @installing; - } - # now, only do work if $comp is the 1st ofed component in installing_list - if ("$comp" eq "$installing[0]") { - ofed_save_autostart(); - init_ofed_rpm_info($CUR_OS_VER); - - # Before we do any builds make sure old stacks removed so we don't - # build against the wrong version of dependent rpms - if (0 != uninstall_prev_versions()) { - return 1; - } - if (ROOT_is_set()) { - # we will build in current image, so must uninstall - # in / as well as $ROOT (above) - my $save_ROOT=$ROOT; - $ROOT='/'; - my $rc = uninstall_prev_versions(); - $ROOT=$save_ROOT; - if (0 != $rc) { - return 1; - } - } - - - print_separator; - my $version=media_version_ofed(); - chomp $version; - printf("Preparing OFA $version $DBG_FREE for Install...\n"); - LogPrint "Preparing OFA $version $DBG_FREE for Install for $CUR_OS_VER\n"; - if (ROOT_is_set()) { - # this directory is used during rpm installs, create it as needed - if (0 != system("mkdir -p $ROOT/var/tmp")) { - NormalPrint("Unable to create $ROOT/var/tmp\n"); - return 1; - } - } - - if (ROOT_is_set()) { - # build in current image - my $save_ROOT=$ROOT; - $ROOT='/'; - my $rc = build_ofed("$install_list", "$installing_list", "$CUR_OS_VER",0,"",$OFED_force_rebuild); - $ROOT=$save_ROOT; - return $rc; - } else { - return build_ofed("$install_list", "$installing_list", "$CUR_OS_VER",0,"",$OFED_force_rebuild); - } - } else { - return 0; - } -} - -# wrapper for installed_driver to handle the fact that OFED drivers used to -# be installed under updates/kernel and now are simply installed under updates -# So we check both places so that upgrade installs can properly detect drivers -# which are in the old location -sub installed_ofed_driver($$$) -{ - my $WhichDriver = shift(); - my $driver_subdir = shift(); - my $subdir = shift(); - - return installed_driver($WhichDriver, "$driver_subdir/$subdir") - || installed_driver($WhichDriver, "$driver_subdir/kernel/$subdir"); -} - -# ========================================================================== -# OFED generic installation routines - -# since most of OFED components are simply data driven by Rpm lists in -# ofed_comp_info, we can implement these support functions which do -# most of the real work for install and uninstall of components - -# OFED has a single start script but controls which ULPs are loaded via -# entries in $OFED_CONFIG (openib.conf) -# change all StartupParams for given ofed component to $newvalue -sub ofed_comp_change_openib_conf_param($$) -{ - my $comp=shift(); - my $newvalue=shift(); - - VerbosePrint("edit $ROOT/$OFED_CONFIG: $comp StartUp set to '$newvalue'\n"); - foreach my $p ( @{ $ofed_comp_info{$comp}{'StartupParams'} } ) { - change_openib_conf_param($p, $newvalue); - } -} - -# generic functions to handle autostart needs for ofed components with -# more complex openib.conf based startup needs. These assume opa_stack handles -# the actual startup script. Hence these focus on the openib.conf parameters -# determine if the given capability is configured for Autostart at boot -sub IsAutostart_ofed_comp2($) -{ - my $comp = shift(); # component to check - my $WhichStartup = $ofed_comp_info{$comp}{'StartupScript'}; - my $ret = IsAutostart($WhichStartup); # just to be safe, test this too - - # to be true, all parameters must be yes - foreach my $p ( @{ $ofed_comp_info{$comp}{'StartupParams'} } ) { - $ret &= ( read_openib_conf_param($p, "") eq "yes"); - } - return $ret; -} -sub autostart_desc_ofed_comp($) -{ - my $comp = shift(); # component to describe - my $WhichStartup = $ofed_comp_info{$comp}{'StartupScript'}; - return "$ComponentInfo{$comp}{'Name'} ($WhichStartup)"; -} -# enable autostart for the given capability -sub enable_autostart_ofed_comp2($) -{ - my $comp = shift(); # component to enable - #my $WhichStartup = $ofed_comp_info{$comp}{'StartupScript'}; - - #opa_stack handles this: enable_autostart($WhichStartup); - ofed_comp_change_openib_conf_param($comp, "yes"); -} -# disable autostart for the given capability -sub disable_autostart_ofed_comp2($) -{ - my $comp = shift(); # component to disable - #my $WhichStartup = $ofed_comp_info{$comp}{'StartupScript'}; - - # Note: as a side effect this ULP will also not be manually started - # when openibd is manually run - #opa_stack handles this: disable_autostart($WhichStartup); - ofed_comp_change_openib_conf_param($comp, "no"); -} - -# OFED has all the ULPs in a single RPM. This function removes the -# drivers from ifs-kernel-updates specific to the given ofed_component -# this is a hack, but its better than uninstall and reinstall ifs-kernel-updates -# every time a ULP is added/removed -sub remove_ofed_kernel_ib_drivers($$) -{ - my $comp = shift(); # component to remove - my $verbosity = shift(); - # cheat on driver_subdir so ofed_components can have some stuff not - # in @Components - # we know driver_subdir is same for all ofed components in ifs-kernel-updates - my $driver_subdir=$ComponentInfo{'opa_stack'}{'DriverSubdir'}; - - my $i; - my @list = split /[[:space:]]+/, $ofed_comp_info{$comp}{'Drivers'}; - for ($i=0; $i < scalar(@list); $i+=2) - { - my $driver=$list[$i]; - my $subdir=$list[$i+1]; - remove_driver("$driver", "$driver_subdir/$subdir", $verbosity); - remove_driver_dirs("$driver_subdir/$subdir"); - } -} - -sub print_install_banner_ofed_comp($) -{ - my $comp = shift(); - - my $version=media_version_ofed(); - chomp $version; - printf("Installing $ComponentInfo{$comp}{'Name'} $version $DBG_FREE...\n"); - # all OFED components at same version as opa_stack - LogPrint "Installing $ComponentInfo{$comp}{'Name'} $version $DBG_FREE for $CUR_OS_VER\n"; -} - -# helper to determine if we need to reinstall due to parameter change -sub need_reinstall_ofed_comp($$$) -{ - my $comp = shift(); - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - if (get_ofed_rpm_prefix(ofed_rpms_dir()) ne "$OFED_prefix" ) { - return "all"; - } elsif (! comp_is_uptodate('opa_stack')) { # all ofed_comp same version - # on upgrade force reinstall to recover from uninstall of old rpms - return "all"; - } else { - return "no"; - } -} - -# helper which does most of the work for installing rpms and drivers -# for an OFED component -# installs ifs-kernel-updates drivers, KernelRpms and UserRpms -# caller must handle any non-RPM files -sub install_ofed_comp($$) -{ - my $comp = shift(); - my $install_list = shift(); # total that will be installed when done - - # special handling for ifs-kernel-updates - if ($ComponentInfo{$comp}{'DriverSubdir'} ne "" ) { - install_kernel_ib(ofed_rpms_dir(), $install_list); - } - # skip ifs-kernel-updates if in KernelRpms/UserRpms, already handled above - ofed_rpm_install_list(ofed_rpms_dir(), $CUR_OS_VER, 1, - ( @{ $ofed_comp_info{$comp}{'KernelRpms'}}, - @{ $ofed_comp_info{$comp}{'UserRpms'}}) ); - # DebugRpms are installed as part of 'ofed_debug' component - -} - -sub print_uninstall_banner_ofed_comp($) -{ - my $comp = shift(); - - NormalPrint("Uninstalling $ComponentInfo{$comp}{'Name'}...\n"); -} - -# uninstall all rpms associated with an OFED component -sub uninstall_ofed_comp_rpms($$$$) -{ - my $comp = shift(); - my $install_list = shift(); - my $uninstalling_list = shift(); - my $verbosity = shift(); - - if ( "$comp" eq "ofed_ib_bonding" && ! $ofed_rpm_info{'ib-bonding'}{'Available'}) { - # special case - do not touch distro ib-bonding - return; - } - # debuginfo never in >1 component, so do explicit uninstall since - # have an odd PartOf relationship which confuses uninstall_not_needed_list - rpm_uninstall_list("any", $verbosity, - @{ $ofed_comp_info{$comp}{'DebugRpms'}}); - ofed_rpm_uninstall_not_needed_list($install_list, $uninstalling_list, $comp, - $verbosity, @{ $ofed_comp_info{$comp}{'UserRpms'}}); - ofed_rpm_uninstall_not_needed_list($install_list, $uninstalling_list, $comp, - $verbosity, @{ $ofed_comp_info{$comp}{'KernelRpms'}}); -} - -# helper which does most of the work for uninstalling rpms and drivers -# for an OFED component -# caller must handle any non-RPM files -sub uninstall_ofed_comp($$$$) -{ - my $comp = shift(); - my $install_list = shift(); - my $uninstalling_list = shift(); - my $verbosity = shift(); - - uninstall_ofed_comp_rpms($comp, $install_list, $uninstalling_list, $verbosity); - remove_ofed_kernel_ib_drivers($comp, $verbosity); -} - -# remove ifs-kernel-updates drivers for components which will not be installed -sub remove_unneeded_kernel_ib_drivers($) -{ - my $install_list = shift(); # total that will be installed when done - foreach my $c ( @ofed_components ) - { - if ($install_list !~ / $c /) { - remove_ofed_kernel_ib_drivers($c, "verbose"); - } - } -} - -# OFED has all the ULPs in a single RPM. This function installs that -# RPM and removes the undesired ULP drivers -sub install_kernel_ib($$) -{ - my $rpmdir = shift(); - my $install_list = shift(); # total that will be installed when done - - my $driver_subdir=$ComponentInfo{'opa_stack'}{'DriverSubdir'}; # same for all ofed components - - if ( $install_kernel_ib_was_run) { - return; - } - - rpm_install("$rpmdir", $CUR_OS_VER, "ifs-kernel-updates"); - remove_unneeded_kernel_ib_drivers($install_list); - - # openib.conf values not directly associated with driver startup are left - # untouched ofed rpm install will keep existing value - - $install_kernel_ib_was_run = 1; -} - -# ========================================================================== -# OFED opa_stack installation - -# determine if the given capability is configured for Autostart at boot -sub IsAutostart2_opa_stack() -{ - # opa_stack is tricky, there are multiple parameters. We just test - # the things we control here, if user has edited openib.conf they - # could end up with startup still disabled by having disabled all - # the individual HCA drivers - return IsAutostart_ofed_comp2('opa_stack') || IsAutostart("iba"); -} -sub autostart_desc_opa_stack() -{ - return autostart_desc_ofed_comp('opa_stack'); -} -# enable autostart for the given capability -sub enable_autostart2_opa_stack() -{ - enable_autostart("openibd"); - ofed_comp_change_openib_conf_param('opa_stack', "yes"); -} -# disable autostart for the given capability -sub disable_autostart2_opa_stack() -{ - disable_autostart("openibd"); - ofed_comp_change_openib_conf_param('opa_stack', "no"); -} - -sub start_opa_stack() -{ - my $driver_subdir=$ComponentInfo{'opa_stack'}{'DriverSubdir'}; - start_driver($ComponentInfo{'opa_stack'}{'Name'}, "ib_core", "$driver_subdir/drivers/infiniband/core", "openibd"); -} - -sub stop_opa_stack() -{ - stop_driver($ComponentInfo{'opa_stack'}{'Name'}, "ib_core", "openibd"); -} - -sub available_opa_stack() -{ - my $srcdir=$ComponentInfo{'opa_stack'}{'SrcDir'}; -# TBD better checks for available? -# check file_glob("$srcdir/SRPMS/ifs-kernel-updates*.src.rpm") ne "" -# || rpm_exists($rpmsdir, $CUR_OS_VER, "ifs-kernel-updates") - return ( -d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ); -} - -sub installed_ofed_opa_stack() -{ - my $driver_subdir=$ComponentInfo{'opa_stack'}{'DriverSubdir'}; - return (rpm_is_installed("libibverbs", "user") - && -e "$ROOT$BASE_DIR/version_ofed" - && rpm_is_installed("ifs-kernel-updates", $CUR_OS_VER) - # MWHEINZ - commented out because ifs-kernel-updates does not follow - # the old ofa_kernel installation model. - # && installed_ofed_driver("ib_core", "$driver_subdir", "drivers/infiniband/core") - ); -} - -sub installed_opa_stack() -{ - return (installed_ofed_opa_stack); -} - -# only called if installed_opa_stack is true -sub installed_version_opa_stack() -{ - if ( -e "$ROOT$BASE_DIR/version_ofed" ) { - return `cat $ROOT$BASE_DIR/version_ofed`; - } else { - return 'NONE'; - } -} - -# only called if available_opa_stack is true -sub media_version_opa_stack() -{ - return media_version_ofed(); -} - -# return 0 on success, 1 on failure -sub run_uninstall($$$) -{ - my $stack = shift(); - my $cmd = shift(); - my $cmdargs = shift(); - - if ( "$cmd" ne "" && -e "$cmd" ) { - NormalPrint "\nUninstalling $stack: chroot /$ROOT $cmd $cmdargs\n"; - if (0 != system("yes | chroot /$ROOT $cmd $cmdargs")) { - NormalPrint "Unable to uninstall $stack\n"; - return 1; - } - } - return 0; -} - -# uninstall 3rd party and older IB stacks -# only called when opa_stack is not installed, hence it can also safely -# uninstall files/rpms which may overlap with the opa_stack -# return 0 on success, != 0 on failure -sub uninstall_old_stacks($) -{ - my $prompt = shift(); - my $ret = 0; - - if ( $prompt) { - NormalPrint "About to Uninstall previous IB Software Installations...\n"; - HitKeyCont; - } - - # FF for OFED requires oftools - # hence we can conclude if FF for OFED is installed by testing - # for opainfo (which is unique to oftools for OFED) - # this way if FF for OFED is already installed, we - # will not run opaconfig -u - # also check our name so we don't recursively call ourselves - # However if FF for QS or QS is installed, we want to run uninstall - if (-e "$ROOT/sbin/opaconfig" - && ! -e "$ROOT$BASE_DIR/version_ofed" - && ! -e "$ROOT/usr/sbin/opainfo" - && my_basename($0) ne "opaconfig" - ) { - $ret |= run_uninstall("QLogic/QuickSilver/SilverStorm IB Stack", "$ROOT/sbin/opaconfig", "-u -r '$ROOT'"); - } - - # uninstall Mellanox OFED - $ret |= run_uninstall("Mellanox OFED IB Stack", "/sbin/mlnx_en_uninstall.sh", "" ); - # uninstall modern OFED - my $ofed_uninstall=`chroot /$ROOT which ofed_uninstall.sh 2>/dev/null`; - $ret |= run_uninstall("OFED IB Stack", "$ofed_uninstall", ""); - my $prefix = ofed_get_prefix(); - $ret |= run_uninstall("OFED IB Stack", "$prefix/sbin/ofed_uninstall.sh", "" ); - $ret |= run_uninstall("OFED IB Stack", "$prefix/uninstall_gen2.sh", "" ); - $ret |= run_uninstall("OFED IB Stack", "$prefix/uninstall.sh", "" ); - ofed_cleanup_mpitests(); - - # uninstall TopSpin/Cisco - if (rpm_uninstall_matches("TopSpin/Cisco IB Stack", "topspin-ib", "")) { - NormalPrint "Unable to uninstall TopSpin/Cisco IB Stack\n"; - $ret = 1; - } - - # uninstall Voltaire - if (rpm_uninstall_matches("Voltaire IB Stack", "Voltaire", "4.0.0_5")) { - NormalPrint "Unable to uninstall Voltaire IB Stack\n"; - $ret = 1; - } - - # uninstall Mellanox - if ("$ENV{MTHOME}" ne "") { - $ret |= run_uninstall("Mellanox IB Stack", "$ENV{MTHOME}/uninstall.sh", ""); - } - $ret |= run_uninstall("Mellanox IB Stack", "/usr/mellanox/uninstall.sh", ""); - $ret |= run_uninstall("Mellanox EN driver", "/sbin/mlnx_en_uninstall.sh", "" ); - # uninstall Mellanox mtnic - if ( -d "$ROOT/lib/modules/$CUR_OS_VER/kernel/drivers/net/mtnic" ) { - NormalPrint "\nUninstalling mtnic driver: chroot /$ROOT /sbin/rmmod mtnic >/dev/null 2>&1; chroot /$ROOT rm -rf /lib/modules/*/kernel/drivers/net/mtnic\n"; - system("chroot /$ROOT /sbin/rmmod mtnic >/dev/null 2>&1; chroot /$ROOT rm -rf /lib/modules/*/kernel/drivers/net/mtnic"); - } - - # workaround a %preun problem in RHEL 5 which included OFED 1.1 - rpm_uninstall_matches("OFED 1.1 iscsi","open-iscsi-2.0-754","", - "--nodeps --notriggers --noscripts"); - rpm_uninstall_matches("OFED 1.1","openib-1.1","", - "--nodeps --notriggers --noscripts"); - - # workaround a %preun problem in RHEL 5.1 which included OFED 1.2 - rpm_uninstall_matches("OFED 1.2","openib-1.2","", - "--nodeps --notriggers --noscripts"); - - # workaround a %preun problem in RHEL 5.3 which included OFED 1.3 - rpm_uninstall_matches("OFED 1.3","iscsi-target-utils-0.1-20080828","", - "--nodeps --notriggers --noscripts"); - rpm_uninstall_matches("OFED 1.3","tgt-0.1-20080828","", - "--nodeps --notriggers --noscripts"); - - # workaround a %preun problem in SLES11 which included OFED 1.4 - rpm_uninstall_matches("OFED 1.4","opensm-3.2.3_20081117_b70e2d2-1.10","", - "--nodeps --notriggers --noscripts"); - rpm_uninstall_matches("OFED 1.4","ofed-1.4.0-11.12","", - "--nodeps --notriggers --noscripts"); - - $ret |= uninstall_old_ofed_rpms("any", "silent", "previous OFED"); - - my $old_ofed = file_glob("$ROOT/usr/local/ofed*"); - if ("$old_ofed" ne "") { - NormalPrint "\nUninstalling previous OFED code: rm -rf $ROOT/usr/local/ofed*\n"; - system("rm -rf $ROOT/usr/local/ofed* >/dev/null 2>/dev/null"); - } - - # some other possible stray files which could be left around - system("rm -rf $ROOT/usr/include/infiniband/complib"); - system("rm -rf $ROOT/usr/include/infiniband/vendor"); - system("rm -rf $ROOT/usr/include/infiniband/opensm"); - system("rm -rf $ROOT/usr/include/infiniband/iba"); - system("rm -rf $ROOT/usr/libosmcomp*"); - system("rm -rf $ROOT/usr/libosmvendor*"); - system("rm -rf $ROOT/usr/libopensm*"); - system("rm -rf $ROOT/usr/bin/opensm"); - system("rm -rf $ROOT/usr/bin/osmtest"); - system("rm -rf $ROOT/usr/local/include/infiniband/complib"); - system("rm -rf $ROOT/usr/local/include/infiniband/vendor"); - system("rm -rf $ROOT/usr/local/include/infiniband/opensm"); - system("rm -rf $ROOT/usr/local/include/infiniband/iba"); - system("rm -rf $ROOT/usr/local/libosmcomp*"); - system("rm -rf $ROOT/usr/local/libosmvendor*"); - system("rm -rf $ROOT/usr/local/libopensm*"); - system("rm -rf $ROOT/usr/local/bin/opensm"); - system("rm -rf $ROOT/usr/local/bin/osmtest"); - - return $ret; -} - -# return 0 on success, !=0 on failure -sub build_opa_stack($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - - init_ofed_rpm_info($osver); - - # Before we do any builds make sure old stacks removed so we don't - # build against the wrong version of dependent rpms - if (0 != uninstall_prev_versions()) { - return 1; - } - - if (ROOT_is_set()) { - # build in current image - my $save_ROOT=$ROOT; - $ROOT='/'; - my $rc = build_ofed("@Components", "@Components", $osver, $debug,$build_temp,$force); - $ROOT=$save_ROOT; - return $rc; - } else { - return build_ofed("@Components", "@Components", $osver, $debug,$build_temp,$force); - } -} - -sub need_reinstall_opa_stack($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('opa_stack', $install_list, $installing_list)); -} - -sub check_os_prereqs_opa_stack -{ - return rpm_check_os_prereqs("opa_stack", "any", ( - 'pciutils', 'libstdc++ any user' - )); -} - -sub preinstall_opa_stack($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("opa_stack", $install_list, $installing_list); -} - -sub install_opa_stack($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - my $srcdir=$ComponentInfo{'opa_stack'}{'SrcDir'}; - - print_install_banner_ofed_comp('opa_stack'); - - #override the udev permissions. - install_udev_permissions("$srcdir/config"); - # set environment variable for RPM to configure linmits_conf - # edit_limitsconf("$srcdir/config"); - setup_env("OPA_LIMITS_CONF", 1); - # We also need to install driver, so setting up envirnment - # to install driver for this component. actual install is done by rpm - setup_env("OPA_INSTALL_DRIVER", 1); - - # Check $BASE_DIR directory ...exist - check_config_dirs(); - check_dir("/usr/lib/opa"); - - copy_systool_file("$srcdir/comp.pl", "/usr/lib/opa/.comp_ofed.pl"); - - install_ofed_comp('opa_stack', $install_list); - - # in some recovery situations OFED doesn't properly restore openib.conf - # this makes sure the SMA NodeDesc is properly set so the hostnmae is used - change_openib_conf_param('NODE_DESC', '$(hostname -s)'); - prompt_openib_conf_param('RENICE_IB_MAD', 'OFED SMI/GSI renice', "y", 'OPA_RENICE_IB_MAD'); - # QIB driver has replaced IPATH, make sure IPATH disabled - change_openib_conf_param('IPATH_LOAD', 'no'); - # MWHEINZ FIXME - disabled because the qib driver is loaded - # automagically by the 3.9.2 kernel. - #if (!build_option_is_allowed($CUR_OS_VER, "--with-qib-mod", %ofed_kernel_ib_options)) { - # change_openib_conf_param('QIB_LOAD', 'no'); - #} else { - # change_openib_conf_param('QIB_LOAD', 'yes'); - #} - # MWHEINZ FIXME - it appears that we are dropping kcopy support. - #if (!build_option_is_allowed($CUR_OS_VER, "--with-kcopy-mod", %ofed_kernel_ib_options)) { - # change_openib_conf_param('KCOPY_LOAD', 'no'); - #} else { - # change_openib_conf_param('KCOPY_LOAD', 'yes'); - #} - - copy_data_file("$srcdir/Version", "$BASE_DIR/version_ofed"); - - # prevent distro's open IB from loading - #add_blacklist("ib_mthca"); - #add_blacklist("ib_ipath"); - disable_distro_ofed(); - need_reboot(); - $ComponentWasInstalled{'opa_stack'}=1; -} - -sub postinstall_opa_stack($$) -{ - my $old_conf = 0; # do we have an existing conf file - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - if ( -e "$ROOT/$OFED_CONFIG" ) { - if (0 == system("cp $ROOT/$OFED_CONFIG $ROOT/$OFED_CONFIG-save")) { - $old_conf=1; - } - } - - # adjust openib.conf autostart settings - foreach my $c ( @ofed_components ) - { - if ($install_list !~ / $c /) { - # disable autostart of uninstalled components - # no need to disable openibd, since being in this function implies - # opa_stack is at least installed - ofed_comp_change_openib_conf_param($c, "no"); - } else { - # retain previous setting for components being installed - # set to no if initial install - # it seems that ifs-kernel-updates rpm will do this for us, - # repeat just to be safe - foreach my $p ( @{ $ofed_comp_info{$c}{'StartupParams'} } ) { - my $old_value = ""; - if ( $old_conf ) { - $old_value = read_openib_conf_param($p, "$ROOT/$OFED_CONFIG-save"); - } - if ( "$old_value" eq "" ) { - $old_value = "no"; - } - change_openib_conf_param($p, $old_value); - } - } - } - - ofed_restore_autostart('opa_stack'); -} - -sub uninstall_opa_stack($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - my $driver_subdir=$ComponentInfo{'opa_stack'}{'DriverSubdir'}; - print_uninstall_banner_ofed_comp('opa_stack'); - stop_opa_stack; - remove_blacklist("ib_qib"); - remove_blacklist("ib_wfr_lite"); - - # allow open IB to load - #remove_blacklist("ib_mthca"); - #remove_blacklist("ib_ipath"); - - # ofed rpm -e will keep an rpmsave copy of openib.conf for us - uninstall_ofed_comp('opa_stack', $install_list, $uninstalling_list, 'verbose'); - remove_driver_dirs($driver_subdir); - #remove_modules_conf; - remove_limits_conf; - - remove_udev_permissions; - - system("rm -rf $ROOT$BASE_DIR/version_ofed"); - system("rm -rf $ROOT/usr/lib/opa/.comp_ofed.pl"); - system "rmdir $ROOT/usr/lib/opa 2>/dev/null"; # remove only if empty - system "rmdir $ROOT$BASE_DIR 2>/dev/null"; # remove only if empty - system "rmdir $ROOT$OPA_CONFIG_DIR 2>/dev/null"; # remove only if empty - if (0 != uninstall_old_stacks(0)) { - Abort "Unable to uninstall old IB stacks\n"; - } - need_reboot(); - $ComponentWasInstalled{'opa_stack'}=0; -} -# ========================================================================== -# intel_hfi installation - -# determine if the given capability is configured for Autostart at boot -sub IsAutostart2_intel_hfi() -{ - return IsAutostart_ofed_comp2('intel_hfi'); -} -sub autostart_desc_intel_hfi() -{ - return autostart_desc_ofed_comp('intel_hfi'); -} -# enable autostart for the given capability -sub enable_autostart2_intel_hfi() -{ - enable_autostart_ofed_comp2('intel_hfi'); -} -# disable autostart for the given capability -sub disable_autostart2_intel_hfi() -{ - disable_autostart_ofed_comp2('intel_hfi'); -} - -sub available_intel_hfi() -{ - my $srcdir=$ComponentInfo{'intel_hfi'}{'SrcDir'}; - return ( (-d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ) - && build_option_is_allowed($CUR_OS_VER, "", %ofed_kernel_ib_options)); -} - -sub installed_intel_hfi() -{ - my $driver_subdir=$ComponentInfo{'intel_hfi'}{'DriverSubdir'}; - return (rpm_is_installed("libhfiverbs", "user") - && -e "$ROOT$BASE_DIR/version_ofed" - && rpm_is_installed("ifs-kernel-updates", $CUR_OS_VER) - # JFLECK: Needs to be adjusted for hfi elements - - # MWHEINZ: The mlx driver is part of stock Linux now. - # && (installed_ofed_driver("mlx4_ib", "$driver_subdir", "drivers/infiniband/hw/mlx4") - # && installed_ofed_driver("mlx4_core", "$driver_subdir", "drivers/net/mlx4")) - ); -} - -# only called if installed_intel_hfi is true -sub installed_version_intel_hfi() -{ - if ( -e "$ROOT$BASE_DIR/version_ofed" ) { - return `cat $ROOT$BASE_DIR/version_ofed`; - } else { - return ""; - } -} - -# only called if available_intel_hfi is true -sub media_version_intel_hfi() -{ - return media_version_ofed(); -} - -sub build_intel_hfi($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_intel_hfi($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('intel_hfi', $install_list, $installing_list)); -} - -sub preinstall_intel_hfi($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("intel_hfi", $install_list, $installing_list); -} - -sub install_intel_hfi($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('intel_hfi'); - install_ofed_comp('intel_hfi', $install_list); - - need_reboot(); - $ComponentWasInstalled{'intel_hfi'}=1; -} - -sub postinstall_intel_hfi($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - ofed_restore_autostart('intel_hfi'); -} - -sub uninstall_intel_hfi($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('intel_hfi'); - # TBD stop_intel_hfi; - uninstall_ofed_comp('intel_hfi', $install_list, $uninstalling_list, 'verbose'); - need_reboot(); - $ComponentWasInstalled{'intel_hfi'}=0; - remove_blacklist('hfi1'); -} - -# ========================================================================== -# ib_wfr_lite installation - -# determine if the given capability is configured for Autostart at boot -sub IsAutostart2_ib_wfr_lite() -{ - return IsAutostart_ofed_comp2('ib_wfr_lite'); -} -sub autostart_desc_ib_wfr_lite() -{ - return autostart_desc_ofed_comp('ib_wfr_lite'); -} -# enable autostart for the given capability -sub enable_autostart2_ib_wfr_lite() -{ - enable_autostart_ofed_comp2('ib_wfr_lite'); -} -# disable autostart for the given capability -sub disable_autostart2_ib_wfr_lite() -{ - disable_autostart_ofed_comp2('ib_wfr_lite'); -} - -sub available_ib_wfr_lite() -{ - my $srcdir=$ComponentInfo{'ib_wfr_lite'}{'SrcDir'}; - return ( (-d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ) - && build_option_is_allowed($CUR_OS_VER, "", %ofed_kernel_ib_options)); -} - -sub installed_ib_wfr_lite() -{ - my $driver_subdir=$ComponentInfo{'ib_wfr_lite'}{'DriverSubdir'}; - return (rpm_is_installed("ib_wfr_lite", "user") - && -e "$ROOT$BASE_DIR/version_ofed" - && rpm_is_installed("ifs-kernel-updates", $CUR_OS_VER) - ); -} - -# only called if installed_ib_wfr_lite is true -sub installed_version_ib_wfr_lite() -{ - if ( -e "$ROOT$BASE_DIR/version_ofed" ) { - return `cat $ROOT$BASE_DIR/version_ofed`; - } else { - return ""; - } -} - -# only called if available_ib_wfr_lite is true -sub media_version_ib_wfr_lite() -{ - return media_version_ofed(); -} - -sub build_ib_wfr_lite($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_ib_wfr_lite($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('ib_wfr_lite', $install_list, $installing_list)); -} - -sub preinstall_ib_wfr_lite($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("ib_wfr_lite", $install_list, $installing_list); -} - -sub install_ib_wfr_lite($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('ib_wfr_lite'); - install_ofed_comp('ib_wfr_lite', $install_list); - - # because the ib_wfr_lite and qib drivers are attached to the same hardware IDs - # only one can be active in the system at a given time so blacklist the one that - # won't currently be in use. - remove_blacklist("ib_wfr_lite"); - add_blacklist("ib_qib"); - - need_reboot(); - $ComponentWasInstalled{'ib_wfr_lite'}=1; -} - -sub postinstall_ib_wfr_lite($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - ofed_restore_autostart('ib_wfr_lite'); -} - -sub uninstall_ib_wfr_lite($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('ib_wfr_lite'); - uninstall_ofed_comp('ib_wfr_lite', $install_list, $uninstalling_list, 'verbose'); - - # because the ib_wfr_lite and qib drivers are attached to the same hardware IDs - # only one can be active in the system at a given time so blacklist the one that - # won't currently be in use. - add_blacklist("ib_wfr_lite"); - remove_blacklist("ib_qib"); - - need_reboot(); - $ComponentWasInstalled{'ib_wfr_lite'}=0; -} - -# ========================================================================== -# OFED ofed_mlx4 installation - -# determine if the given capability is configured for Autostart at boot -sub IsAutostart2_ofed_mlx4() -{ - return IsAutostart_ofed_comp2('ofed_mlx4'); -} -sub autostart_desc_ofed_mlx4() -{ - return autostart_desc_ofed_comp('ofed_mlx4'); -} -# enable autostart for the given capability -sub enable_autostart2_ofed_mlx4() -{ - enable_autostart_ofed_comp2('ofed_mlx4'); -} -# disable autostart for the given capability -sub disable_autostart2_ofed_mlx4() -{ - disable_autostart_ofed_comp2('ofed_mlx4'); -} - -# these are not presently called, which is good since ofed is hard to do this -#sub start_ofed_mlx4() -#{ -# my $driver_subdir=$ComponentInfo{'ofed_mlx4'}{'DriverSubdir'}; -# start_driver($ComponentInfo{'ofed_mlx4'}{'Name'}, "ib_core", $driver_subdir, "openibd"); -#} - -#sub stop_ofed_mlx4() -#{ -# stop_driver($ComponentInfo{'ofed_mlx4'}{'Name'}, "ib_core", "openibd"); -#} - -sub available_ofed_mlx4() -{ - my $srcdir=$ComponentInfo{'ofed_mlx4'}{'SrcDir'}; - return ( (-d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ) - && build_option_is_allowed($CUR_OS_VER, "--with-mlx4-mod", %ofed_kernel_ib_options)); -} - -sub installed_ofed_mlx4() -{ - my $driver_subdir=$ComponentInfo{'ofed_mlx4'}{'DriverSubdir'}; - return (rpm_is_installed("libmlx4", "user") - && -e "$ROOT$BASE_DIR/version_ofed" - && rpm_is_installed("ifs-kernel-updates", $CUR_OS_VER) - # MWHEINZ: The mlx driver is part of stock Linux now. - # && (installed_ofed_driver("mlx4_ib", "$driver_subdir", "drivers/infiniband/hw/mlx4") - # && installed_ofed_driver("mlx4_core", "$driver_subdir", "drivers/net/mlx4")) - ); -} - -# only called if installed_ofed_mlx4 is true -sub installed_version_ofed_mlx4() -{ - if ( -e "$ROOT$BASE_DIR/version_ofed" ) { - return `cat $ROOT$BASE_DIR/version_ofed`; - } else { - return ""; - } -} - -# only called if available_ofed_mlx4 is true -sub media_version_ofed_mlx4() -{ - return media_version_ofed(); -} - -sub build_ofed_mlx4($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_ofed_mlx4($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('ofed_mlx4', $install_list, $installing_list)); -} - -sub preinstall_ofed_mlx4($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("ofed_mlx4", $install_list, $installing_list); -} - -sub install_ofed_mlx4($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('ofed_mlx4'); - install_ofed_comp('ofed_mlx4', $install_list); - - need_reboot(); - $ComponentWasInstalled{'ofed_mlx4'}=1; -} - -sub postinstall_ofed_mlx4($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - ofed_restore_autostart('ofed_mlx4'); -} - -sub uninstall_ofed_mlx4($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('ofed_mlx4'); - # TBD stop_ofed_mlx4; - uninstall_ofed_comp('ofed_mlx4', $install_list, $uninstalling_list, 'verbose'); - need_reboot(); - $ComponentWasInstalled{'ofed_mlx4'}=0; -} - - -# ========================================================================== -# OFED opa_stack development installation - -sub available_opa_stack_dev() -{ - my $srcdir=$ComponentInfo{'opa_stack_dev'}{'SrcDir'}; - return ( -d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ); -} - -sub installed_opa_stack_dev() -{ - return (rpm_is_installed("libibverbs-devel", "user") - && -e "$ROOT$BASE_DIR/version_ofed"); -} - -# only called if installed_opa_stack_dev is true -sub installed_version_opa_stack_dev() -{ - if ( -e "$ROOT$BASE_DIR/version_ofed" ) { - return `cat $ROOT$BASE_DIR/version_ofed`; - } else { - return ""; - } -} - -# only called if available_opa_stack_dev is true -sub media_version_opa_stack_dev() -{ - return media_version_ofed(); -} - -sub build_opa_stack_dev($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_opa_stack_dev($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('opa_stack_dev', $install_list, $installing_list)); -} - -sub preinstall_opa_stack_dev($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("opa_stack_dev", $install_list, $installing_list); -} - -sub install_opa_stack_dev($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('opa_stack_dev'); - install_ofed_comp('opa_stack_dev', $install_list); - - $ComponentWasInstalled{'opa_stack_dev'}=1; -} - -sub postinstall_opa_stack_dev($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - #ofed_restore_autostart('opa_stack_dev'); -} - -sub uninstall_opa_stack_dev($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('opa_stack_dev'); - uninstall_ofed_comp('opa_stack_dev', $install_list, $uninstalling_list, 'verbose'); - $ComponentWasInstalled{'opa_stack_dev'}=0; -} - -# ========================================================================== -# OFED ofed_ipoib installation - -my $FirstIPoIBInterface=0; # first device is ib0 - -# determine if the given capability is configured for Autostart at boot -sub IsAutostart2_ofed_ipoib() -{ - return IsAutostart_ofed_comp2('ofed_ipoib') || IsAutostart("ipoib"); -} -sub autostart_desc_ofed_ipoib() -{ - return autostart_desc_ofed_comp('ofed_ipoib'); -} -# enable autostart for the given capability -sub enable_autostart2_ofed_ipoib() -{ - enable_autostart_ofed_comp2('ofed_ipoib'); -} -# disable autostart for the given capability -sub disable_autostart2_ofed_ipoib() -{ - disable_autostart_ofed_comp2('ofed_ipoib'); - if (Exist_ifcfg("ib")) { - print "$ComponentInfo{'ofed_ipoib'}{'Name'} will autostart if ifcfg files exists\n"; - print "To fully disable autostart, it's recommended to also remove related ifcfg files\n"; - Remove_ifcfg("ib_ipoib","$ComponentInfo{'ofed_ipoib'}{'Name'}","ib"); - } -} - -# these are not presently called, which is good since ofed is hard to do this -#sub start_ofed_ipoib() -#{ -# my $driver_subdir=$ComponentInfo{'ofed_ipoib'}{'DriverSubdir'}; -# start_driver($ComponentInfo{'ofed_ipoib'}{'Name'}, "ib_core", $driver_subdir, "openibd"); -#} - -#sub stop_ofed_ipoib() -#{ -# stop_driver($ComponentInfo{'ofed_ipoib'}{'Name'}, "ib_core", "openibd"); -#} - -sub available_ofed_ipoib() -{ - my $srcdir=$ComponentInfo{'ofed_ipoib'}{'SrcDir'}; - return ( -d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ); -} - -sub installed_ofed_ipoib() -{ - my $driver_subdir=$ComponentInfo{'ofed_ipoib'}{'DriverSubdir'}; - return ((-e "$ROOT$BASE_DIR/version_ofed" - && rpm_is_installed("ifs-kernel-updates", $CUR_OS_VER))); -} - -# only called if installed_ofed_ipoib is true -sub installed_version_ofed_ipoib() -{ - return `cat $ROOT$BASE_DIR/version_ofed`; -} - -# only called if available_ofed_ipoib is true -sub media_version_ofed_ipoib() -{ - return media_version_ofed(); -} - -sub build_ofed_ipoib($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_ofed_ipoib($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('ofed_ipoib', $install_list, $installing_list)); -} - -sub preinstall_ofed_ipoib($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("ofed_ipoib", $install_list, $installing_list); -} - -sub install_ofed_ipoib($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('ofed_ipoib'); - install_ofed_comp('ofed_ipoib', $install_list); - - prompt_openib_conf_param('SET_IPOIB_CM', 'IPoIB Connected Mode', "y", 'OPA_SET_IPOIB_CM'); - # bonding is more involved, require user to edit to enable that - Config_ifcfg(1,"$ComponentInfo{'ofed_ipoib'}{'Name'}","ib", "$FirstIPoIBInterface",1); - check_network_config; - #Config_IPoIB_cfg; - #add_insserv_conf("openibd", "network"); - need_reboot(); - $ComponentWasInstalled{'ofed_ipoib'}=1; -} - -sub postinstall_ofed_ipoib($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - ofed_restore_autostart('ofed_ipoib'); -} - -sub uninstall_ofed_ipoib($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('ofed_ipoib'); - # TBD stop_ofed_ipoib; - uninstall_ofed_comp('ofed_ipoib', $install_list, $uninstalling_list, 'verbose'); - #del_insserv_conf("openibd", "network"); - Remove_ifcfg("ib_ipoib","$ComponentInfo{'ofed_ipoib'}{'Name'}","ib"); - need_reboot(); - $ComponentWasInstalled{'ofed_ipoib'}=0; -} - -# ========================================================================== -# OFED ofed_ib_bonding installation - -# ib_bonding does not have any autostart configuration - -sub available_ofed_ib_bonding() -{ - my $srcdir=$ComponentInfo{'ofed_ib_bonding'}{'SrcDir'}; - return ( (-d "$srcdir/SRPMS" || -d "$srcdir/RPMS") - && available_srpm("ib-bonding", $CUR_OS_VER, $CUR_OS_VER)); -} - -sub installed_ofed_ib_bonding() -{ - # TBD - should we detect OFED vs distro ib-bonding? - return (-e "$ROOT$BASE_DIR/version_ofed" - && rpm_is_installed("ib-bonding", $CUR_OS_VER)); -} - -# only called if installed_ofed_ib_bonding is true -sub installed_version_ofed_ib_bonding() -{ - if ( -e "$ROOT$BASE_DIR/version_ofed" ) { - return `cat $ROOT$BASE_DIR/version_ofed`; - } else { - return ""; - } -} - -# only called if available_ofed_ib_bonding is true -sub media_version_ofed_ib_bonding() -{ - return media_version_ofed(); -} - -sub build_ofed_ib_bonding($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_ofed_ib_bonding($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('ofed_ib_bonding', $install_list, $installing_list)); -} - -sub preinstall_ofed_ib_bonding($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("ofed_ib_bonding", $install_list, $installing_list); -} - -sub install_ofed_ib_bonding($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('ofed_ib_bonding'); - install_ofed_comp('ofed_ib_bonding', $install_list); - - need_reboot(); - $ComponentWasInstalled{'ofed_ib_bonding'}=1; -} - -sub postinstall_ofed_ib_bonding($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - #ofed_restore_autostart('ofed_ib_bonding'); -} - -sub uninstall_ofed_ib_bonding($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('ofed_ib_bonding'); - # TBD stop_ofed_ib_bonding; - uninstall_ofed_comp('ofed_ib_bonding', $install_list, $uninstalling_list, 'verbose'); - need_reboot(); - $ComponentWasInstalled{'ofed_ib_bonding'}=0; -} - -# ========================================================================== -# OFED ofed_udapl installation - -sub available_ofed_udapl() -{ - my $srcdir=$ComponentInfo{'ofed_udapl'}{'SrcDir'}; - return ( (-d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ) - && available_srpm("dapl", "user", $CUR_OS_VER)); -} - -sub installed_ofed_udapl() -{ - return ((rpm_is_installed("dapl", "user") - && -e "$ROOT$BASE_DIR/version_ofed" )); -} - -# only called if installed_ofed_udapl is true -sub installed_version_ofed_udapl() -{ - return `cat $ROOT$BASE_DIR/version_ofed`; -} - -# only called if available_ofed_udapl is true -sub media_version_ofed_udapl() -{ - return media_version_ofed(); -} - -sub build_ofed_udapl($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_ofed_udapl($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('ofed_udapl', $install_list, $installing_list)); -} - -sub preinstall_ofed_udapl($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("ofed_udapl", $install_list, $installing_list); -} - -sub install_ofed_udapl($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('ofed_udapl'); - install_ofed_comp('ofed_udapl', $install_list); - - $ComponentWasInstalled{'ofed_udapl'}=1; -} - -sub postinstall_ofed_udapl($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - #ofed_restore_autostart('ofed_udapl'); -} - -sub uninstall_ofed_udapl($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('ofed_udapl'); - # TBD stop_ofed_udapl; - uninstall_ofed_comp('ofed_udapl', $install_list, $uninstalling_list, 'verbose'); - $ComponentWasInstalled{'ofed_udapl'}=0; -} - -# ========================================================================== -# OFED mpi-selector installation - -sub available_mpi_selector() -{ - my $srcdir=$ComponentInfo{'mpi_selector'}{'SrcDir'}; - return ( -d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ); -} - -sub installed_mpi_selector() -{ - return (rpm_is_installed("mpi-selector", "user") - && -e "$ROOT$BASE_DIR/version_ofed"); -} - -# only called if installed_mpi_selector is true -sub installed_version_mpi_selector() -{ - if ( -e "$ROOT$BASE_DIR/version_ofed" ) { - return `cat $ROOT$BASE_DIR/version_ofed`; - } else { - return ""; - } -} - -# only called if available_mpi_selector is true -sub media_version_mpi_selector() -{ - return media_version_ofed(); -} - -sub build_mpi_selector($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_mpi_selector($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('mpi_selector', $install_list, $installing_list)); -} - -sub check_os_prereqs_mpi_selector -{ - return rpm_check_os_prereqs("mpi_selector", "any", ( "tcsh")) -} - -sub preinstall_mpi_selector($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("mpi_selector", $install_list, $installing_list); -} - -sub install_mpi_selector($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('mpi_selector'); - install_ofed_comp('mpi_selector', $install_list); - - $ComponentWasInstalled{'mpi_selector'}=1; -} - -sub postinstall_mpi_selector($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - #ofed_restore_autostart('mpi_selector'); -} - -sub uninstall_mpi_selector($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - uninstall_ofed_comp('mpiRest', $install_list, $uninstalling_list, 'verbose'); - print_uninstall_banner_ofed_comp('mpi_selector'); - uninstall_ofed_comp('mpi_selector', $install_list, $uninstalling_list, 'verbose'); - ofed_cleanup_mpitests(); - $ComponentWasInstalled{'mpi_selector'}=0; -} - -# ========================================================================== -# OFED MVAPICH2 for gcc installation - -sub available_mvapich2() -{ - my $srcdir=$ComponentInfo{'mvapich2'}{'SrcDir'}; - return ( -d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ); -} - -sub installed_mvapich2() -{ - return ((rpm_is_installed("mvapich2_gcc", "user") - && -e "$ROOT$BASE_DIR/version_ofed")); -} - -# only called if installed_mvapich2 is true -sub installed_version_mvapich2() -{ - return `cat $ROOT$BASE_DIR/version_ofed`; -} - -# only called if available_mvapich2 is true -sub media_version_mvapich2() -{ - return media_version_ofed(); -} - -sub build_mvapich2($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_mvapich2($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('mvapich2', $install_list, $installing_list)); -} - -sub check_os_prereqs_mvapich2 -{ - return rpm_check_os_prereqs("mvapich2", "user", ( "sysfsutils", "libstdc++")); -} - -sub preinstall_mvapich2($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("mvapich2", $install_list, $installing_list); -} - -sub install_mvapich2($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('mvapich2'); - - # make sure any old potentially custom built versions of mpi are uninstalled - rpm_uninstall_list2("any", "--nodeps", 'silent', @{ $ofed_comp_info{'mvapich2'}{'UserRpms'}}); - my $rpmfile = rpm_resolve(ofed_rpms_dir(), "any", "mvapich2_gcc"); - if ( "$rpmfile" ne "" && -e "$rpmfile" ) { - my $mpich_prefix= "$OFED_prefix/mpi/gcc/mvapich2-" - . rpm_query_attr($rpmfile, "VERSION"); - if ( -d "$mpich_prefix" && GetYesNo ("Remove $mpich_prefix directory?", "y")) { - LogPrint "rm -rf $mpich_prefix\n"; - system("rm -rf $mpich_prefix"); - } - } - - install_ofed_comp('mvapich2', $install_list); - - $ComponentWasInstalled{'mvapich2'}=1; -} - -sub postinstall_mvapich2($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - #ofed_restore_autostart('mvapich2'); -} - -sub uninstall_mvapich2($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('mvapich2'); - uninstall_ofed_comp('mvapich2', $install_list, $uninstalling_list, 'verbose'); - ofed_cleanup_mpitests(); - $ComponentWasInstalled{'mvapich2'}=0; -} - -# ========================================================================== -# OFED OpenMpi for gcc installation - -sub available_openmpi() -{ - my $srcdir=$ComponentInfo{'openmpi'}{'SrcDir'}; - return ( -d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ); -} - -sub installed_openmpi() -{ - return ((rpm_is_installed("openmpi_gcc_hfi", "user") - && -e "$ROOT$BASE_DIR/version_ofed")); -} - -# only called if installed_openmpi is true -sub installed_version_openmpi() -{ - return `cat $ROOT$BASE_DIR/version_ofed`; -} - -# only called if available_openmpi is true -sub media_version_openmpi() -{ - return media_version_ofed(); -} - -sub build_openmpi($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_openmpi($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('openmpi', $install_list, $installing_list)); -} - -sub check_os_prereqs_openmpi -{ - return rpm_check_os_prereqs("openmpi", "user", ( "libstdc++")); -} - -sub preinstall_openmpi($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("openmpi", $install_list, $installing_list); -} - -sub install_openmpi($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('openmpi'); - - # make sure any old potentially custom built versions of mpi are uninstalled - rpm_uninstall_list2("any", "--nodeps", 'silent', @{ $ofed_comp_info{'openmpi'}{'UserRpms'}}); - my $rpmfile = rpm_resolve(ofed_rpms_dir(), "any", "openmpi_gcc"); - if ( "$rpmfile" ne "" && -e "$rpmfile" ) { - my $mpich_prefix= "$OFED_prefix/mpi/gcc/openmpi-" - . rpm_query_attr($rpmfile, "VERSION"); - if ( -d "$mpich_prefix" && GetYesNo ("Remove $mpich_prefix directory?", "y")) { - LogPrint "rm -rf $mpich_prefix\n"; - system("rm -rf $mpich_prefix"); - } - } - - install_ofed_comp('openmpi', $install_list); - - $ComponentWasInstalled{'openmpi'}=1; -} - -sub postinstall_openmpi($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - #ofed_restore_autostart('openmpi'); -} - -sub uninstall_openmpi($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('openmpi'); - uninstall_ofed_comp('openmpi', $install_list, $uninstalling_list, 'verbose'); - ofed_cleanup_mpitests(); - $ComponentWasInstalled{'openmpi'}=0; -} - -# ========================================================================== -# OFED gasnet for gcc installation - -sub available_gasnet() -{ - my $srcdir=$ComponentInfo{'gasnet'}{'SrcDir'}; - return ( -d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ); -} - -sub installed_gasnet() -{ - return ((rpm_is_installed("gasnet_gcc_hfi", "user") - && -e "$ROOT$BASE_DIR/version_ofed")); -} - -# only called if installed_gasnet is true -sub installed_version_gasnet() -{ - return `cat $ROOT$BASE_DIR/version_ofed`; -} - -# only called if available_gasnet is true -sub media_version_gasnet() -{ - return media_version_ofed(); -} - -sub build_gasnet($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_gasnet($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('gasnet', $install_list, $installing_list)); -} - -sub preinstall_gasnet($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("gasnet", $install_list, $installing_list); -} - -sub install_gasnet($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('gasnet'); - - # make sure any old potentially custom built versions of mpi are uninstalled - rpm_uninstall_list2("any", "--nodeps", 'silent', @{ $ofed_comp_info{'gasnet'}{'UserRpms'}}); - my $rpmfile = rpm_resolve(ofed_rpms_dir(), "any", "gasnet"); - if ( "$rpmfile" ne "" && -e "$rpmfile" ) { - my $mpich_prefix= "$OFED_prefix/shmem/gcc/gasnet-" - . rpm_query_attr($rpmfile, "VERSION"); - if ( -d "$mpich_prefix" && GetYesNo ("Remove $mpich_prefix directory?", "y")) { - LogPrint "rm -rf $mpich_prefix\n"; - system("rm -rf $mpich_prefix"); - } - } - - install_ofed_comp('gasnet', $install_list); - - $ComponentWasInstalled{'gasnet'}=1; -} - -sub postinstall_gasnet($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - #ofed_restore_autostart('gasnet'); -} - -sub uninstall_gasnet($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('gasnet'); - uninstall_ofed_comp('gasnet', $install_list, $uninstalling_list, 'verbose'); -# ofed_cleanup_mpitests(); - $ComponentWasInstalled{'gasnet'}=0; -} - -# ========================================================================== -# OFED openshmem for gcc installation - -sub available_openshmem() -{ - my $srcdir=$ComponentInfo{'openshmem'}{'SrcDir'}; - return ( -d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ); -} - -sub installed_openshmem() -{ - return ((rpm_is_installed("openshmem_gcc_hfi", "user") - && -e "$ROOT$BASE_DIR/version_ofed")); -} - -# only called if installed_openshmem is true -sub installed_version_openshmem() -{ - return `cat $ROOT$BASE_DIR/version_ofed`; -} - -# only called if available_openshmem is true -sub media_version_openshmem() -{ - return media_version_ofed(); -} - -sub build_openshmem($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_openshmem($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('openshmem', $install_list, $installing_list)); -} - -sub preinstall_openshmem($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("openshmem", $install_list, $installing_list); -} - -sub install_openshmem($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('openshmem'); - - # make sure any old potentially custom built versions of mpi are uninstalled - rpm_uninstall_list2("any", "--nodeps", 'silent', @{ $ofed_comp_info{'openshmem'}{'UserRpms'}}); - my $rpmfile = rpm_resolve(ofed_rpms_dir(), "any", "openshmem"); - if ( "$rpmfile" ne "" && -e "$rpmfile" ) { - my $mpich_prefix= "$OFED_prefix/shmem/gcc/openshmem-" - . rpm_query_attr($rpmfile, "VERSION"); - if ( -d "$mpich_prefix" && GetYesNo ("Remove $mpich_prefix directory?", "y")) { - LogPrint "rm -rf $mpich_prefix\n"; - system("rm -rf $mpich_prefix"); - } - } - - install_ofed_comp('openshmem', $install_list); - - $ComponentWasInstalled{'openshmem'}=1; -} - -sub postinstall_openshmem($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - #ofed_restore_autostart('openshmem'); -} - -sub uninstall_openshmem($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('openshmem'); - uninstall_ofed_comp('openshmem', $install_list, $uninstalling_list, 'verbose'); -# ofed_cleanup_mpitests(); - $ComponentWasInstalled{'openshmem'}=0; -} - -# ========================================================================== -# OFED ofed_mpisrc installation - -sub available_ofed_mpisrc() -{ - my $srcdir=$ComponentInfo{'ofed_mpisrc'}{'SrcDir'}; -# TBD better checks for available? -# check file_glob("$srcdir/SRPMS/mvapich-*.src.rpm") ne "" -# check file_glob("$srcdir/SRPMS/mvapich2-*.src.rpm") ne "" -# check file_glob("$srcdir/SRPMS/openmpi-*.src.rpm") ne "" - return ( (-d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ) ); -} - -sub installed_ofed_mpisrc() -{ - return ((-e "$ROOT$BASE_DIR/version_ofed" - && file_glob("$ROOT/usr/src/opa/MPI/mvapich*.src.rpm") ne "" - && file_glob("$ROOT/usr/src/opa/MPI/openmpi*.src.rpm") ne "" - && file_glob("$ROOT/usr/src/opa/MPI/mpitests*.src.rpm") ne "")); -} - -# only called if installed_ofed_mpisrc is true -sub installed_version_ofed_mpisrc() -{ - return `cat $ROOT$BASE_DIR/version_ofed`; -} - -# only called if available_ofed_mpisrc is true -sub media_version_ofed_mpisrc() -{ - return media_version_ofed(); -} - -sub build_ofed_mpisrc($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_ofed_mpisrc($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('ofed_mpisrc', $install_list, $installing_list)); -} - -sub check_os_prereqs_ofed_mpisrc -{ - return rpm_check_os_prereqs("ofed_mpisrc", "any", - ( @{ $ofed_srpm_info{'mvapich'}{'BuildPrereq'}}, - @{ $ofed_srpm_info{'openmpi'}{'BuildPrereq'}}, - @{ $ofed_srpm_info{'mvapich2'}{'BuildPrereq'}} )); -} - -sub preinstall_ofed_mpisrc($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("ofed_mpisrc", $install_list, $installing_list); -} - -sub install_ofed_mpisrc($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - my $srcdir=$ComponentInfo{'ofed_mpisrc'}{'SrcDir'}; - - print_install_banner_ofed_comp('ofed_mpisrc'); - install_ofed_comp('ofed_mpisrc', $install_list); - check_dir("/usr/src/opa"); - check_dir("/usr/src/opa/MPI"); - # remove old versions (.src.rpm and built .rpm files too) - system "rm -rf $ROOT/usr/src/opa/MPI/mvapich[-_]*.rpm 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/mvapich2[-_]*.rpm 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/openmpi[-_]*.rpm 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/mpitests[-_]*.rpm 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/make.*.res 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/make.*.err 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/make.*.warn 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/.mpiinfo 2>/dev/null"; - - # install new versions - foreach my $srpm ( "mvapich2", "openmpi", "mpitests" ) { - my $srpmfile = file_glob("$srcdir/$SRPMS_SUBDIR/${srpm}-*.src.rpm"); - if ( "$srpmfile" ne "" ) { - my $file = my_basename($srpmfile); - copy_data_file($srpmfile, "/usr/src/opa/MPI/$file"); - } - } - copy_systool_file("$srcdir/do_build", "/usr/src/opa/MPI/do_build"); - copy_systool_file("$srcdir/do_mvapich2_build", "/usr/src/opa/MPI/do_mvapich2_build"); - copy_systool_file("$srcdir/do_openmpi_build", "/usr/src/opa/MPI/do_openmpi_build"); - - $ComponentWasInstalled{'ofed_mpisrc'}=1; -} - -sub postinstall_ofed_mpisrc($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - #ofed_restore_autostart('ofed_mpisrc'); -} - -sub uninstall_ofed_mpisrc($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('ofed_mpisrc'); - - # remove old versions (.src.rpm and built .rpm files too) - system "rm -rf $ROOT/usr/src/opa/MPI/mvapich2[-_]*.rpm 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/openmpi[-_]*.rpm 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/mpitests[-_]*.rpm 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/make.*.res 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/make.*.err 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/make.*.warn 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/.mpiinfo 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/do_build 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/do_mvapich2_build 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/do_openmpi_build 2>/dev/null"; - system "rm -rf $ROOT/usr/src/opa/MPI/.mpiinfo 2>/dev/null"; - - uninstall_ofed_comp('ofed_mpisrc', $install_list, $uninstalling_list, 'verbose'); - system "rmdir $ROOT/usr/src/opa/MPI 2>/dev/null"; # remove only if empty - system "rmdir $ROOT/usr/src/opa 2>/dev/null"; # remove only if empty - $ComponentWasInstalled{'ofed_mpisrc'}=0; -} - -# ========================================================================== -# OFED ofed_srp installation - -# determine if the given capability is configured for Autostart at boot -sub IsAutostart2_ofed_srp() -{ - return IsAutostart_ofed_comp2('ofed_srp'); -} -sub autostart_desc_ofed_srp() -{ - return autostart_desc_ofed_comp('ofed_srp'); -} -# enable autostart for the given capability -sub enable_autostart2_ofed_srp() -{ - enable_autostart_ofed_comp2('ofed_srp'); -} -# disable autostart for the given capability -sub disable_autostart2_ofed_srp() -{ - disable_autostart_ofed_comp2('ofed_srp'); -} - -# these are not presently called, which is good since ofed is hard to do this -#sub start_ofed_srp() -#{ -# my $driver_subdir=$ComponentInfo{'ofed_srp'}{'DriverSubdir'}; -# start_driver($ComponentInfo{'ofed_srp'}{'Name'}, "ib_core", $driver_subdir, "openibd"); -#} - -#sub stop_ofed_srp() -#{ -# stop_driver($ComponentInfo{'ofed_srp'}{'Name'}, "ib_core", "openibd"); -#} - -sub available_ofed_srp() -{ - my $srcdir=$ComponentInfo{'ofed_srp'}{'SrcDir'}; - return ( -d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ); -} - -sub installed_ofed_srp() -{ - my $driver_subdir=$ComponentInfo{'ofed_srp'}{'DriverSubdir'}; - return (rpm_is_installed("srptools", "user") - && -e "$ROOT$BASE_DIR/version_ofed" - && rpm_is_installed("ifs-kernel-updates", $CUR_OS_VER) - # MWHEINZ: using stock srp. - # && installed_ofed_driver("ib_srp", "$driver_subdir", "drivers/infiniband/ulp/srp") - ); -} - -# only called if installed_ofed_srp is true -sub installed_version_ofed_srp() -{ - if ( -e "$ROOT$BASE_DIR/version_ofed" ) { - return `cat $ROOT$BASE_DIR/version_ofed`; - } else { - return ""; - } -} - -# only called if available_ofed_srp is true -sub media_version_ofed_srp() -{ - return media_version_ofed(); -} - -sub build_ofed_srp($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_ofed_srp($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('ofed_srp', $install_list, $installing_list)); -} - -sub preinstall_ofed_srp($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("ofed_srp", $install_list, $installing_list); -} - -sub install_ofed_srp($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('ofed_srp'); - install_ofed_comp('ofed_srp', $install_list); - - prompt_openib_conf_param('SRPHA_ENABLE', 'OFA SRP High Availability deamon', "n", 'OPA_SRPHA_ENABLE'); - need_reboot(); - $ComponentWasInstalled{'ofed_srp'}=1; -} - -sub postinstall_ofed_srp($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - ofed_restore_autostart('ofed_srp'); -} - -sub uninstall_ofed_srp($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('ofed_srp'); - # TBD stop_ofed_srp; - uninstall_ofed_comp('ofed_srp', $install_list, $uninstalling_list, 'verbose'); - need_reboot(); - $ComponentWasInstalled{'ofed_srp'}=0; -} - -# ========================================================================== -# OFED ofed_srpt installation - -# determine if the given capability is configured for Autostart at boot -sub IsAutostart2_ofed_srpt() -{ - return IsAutostart_ofed_comp2('ofed_srpt'); -} -sub autostart_desc_ofed_srpt() -{ - return autostart_desc_ofed_comp('ofed_srpt'); -} -# enable autostart for the given capability -sub enable_autostart2_ofed_srpt() -{ - enable_autostart_ofed_comp2('ofed_srpt'); -} -# disable autostart for the given capability -sub disable_autostart2_ofed_srpt() -{ - disable_autostart_ofed_comp2('ofed_srpt'); -} - -# these are not presently called, which is good since ofed is hard to do this -#sub start_ofed_srpt() -#{ -# my $driver_subdir=$ComponentInfo{'ofed_srpt'}{'DriverSubdir'}; -# start_driver($ComponentInfo{'ofed_srpt'}{'Name'}, "ib_core", $driver_subdir, "openibd"); -#} - -#sub stop_ofed_srpt() -#{ -# stop_driver($ComponentInfo{'ofed_srpt'}{'Name'}, "ib_core", "openibd"); -#} - -sub available_ofed_srpt() -{ - my $srcdir=$ComponentInfo{'ofed_srpt'}{'SrcDir'}; - return ( (-d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ) - && build_option_is_allowed($CUR_OS_VER, "--with-srp-target-mod", %ofed_kernel_ib_options)); -} - -sub installed_ofed_srpt() -{ - my $driver_subdir=$ComponentInfo{'ofed_srpt'}{'DriverSubdir'}; - return (-e "$ROOT$BASE_DIR/version_ofed" - && rpm_is_installed("ifs-kernel-updates", $CUR_OS_VER) - # MWHEINZ: Using stock srpt. - # && installed_ofed_driver("ib_srpt", "$driver_subdir", "drivers/infiniband/ulp/srpt") - ); -} - -# only called if installed_ofed_srpt is true -sub installed_version_ofed_srpt() -{ - if ( -e "$ROOT$BASE_DIR/version_ofed" ) { - return `cat $ROOT$BASE_DIR/version_ofed`; - } else { - return ""; - } -} - -# only called if available_ofed_srpt is true -sub media_version_ofed_srpt() -{ - return media_version_ofed(); -} - -sub build_ofed_srpt($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_ofed_srpt($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('ofed_srpt', $install_list, $installing_list)); -} - -sub preinstall_ofed_srpt($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("ofed_srpt", $install_list, $installing_list); -} - -sub install_ofed_srpt($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('ofed_srpt'); - install_ofed_comp('ofed_srpt', $install_list); - - need_reboot(); - $ComponentWasInstalled{'ofed_srpt'}=1; -} - -sub postinstall_ofed_srpt($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - ofed_restore_autostart('ofed_srpt'); -} - -sub uninstall_ofed_srpt($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('ofed_srpt'); - # TBD stop_ofed_srpt; - uninstall_ofed_comp('ofed_srpt', $install_list, $uninstalling_list, 'verbose'); - need_reboot(); - $ComponentWasInstalled{'ofed_srpt'}=0; -} - -# ========================================================================== -# OFED ofed_iser installation - -# determine if the given capability is configured for Autostart at boot -sub IsAutostart2_ofed_iser() -{ - return IsAutostart_ofed_comp2('ofed_iser'); -} -sub autostart_desc_ofed_iser() -{ - return autostart_desc_ofed_comp('ofed_iser'); -} -# enable autostart for the given capability -sub enable_autostart2_ofed_iser() -{ - enable_autostart_ofed_comp2('ofed_iser'); -} -# disable autostart for the given capability -sub disable_autostart2_ofed_iser() -{ - disable_autostart_ofed_comp2('ofed_iser'); -} - -# these are not presently called, which is good since ofed is hard to do this -#sub start_ofed_iser() -#{ -# my $driver_subdir=$ComponentInfo{'ofed_iser'}{'DriverSubdir'}; -# start_driver($ComponentInfo{'ofed_iser'}{'Name'}, "ib_core", $driver_subdir, "openibd"); -#} - -#sub stop_ofed_iser() -#{ -# stop_driver($ComponentInfo{'ofed_iser'}{'Name'}, "ib_core", "openibd"); -#} - -sub available_ofed_iser() -{ - my $srcdir=$ComponentInfo{'ofed_iser'}{'SrcDir'}; - return ( (-d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ) - && build_option_is_allowed($CUR_OS_VER, "--with-iser-mod", %ofed_kernel_ib_options)); -} - -sub installed_ofed_iser() -{ - my $driver_subdir=$ComponentInfo{'ofed_iser'}{'DriverSubdir'}; - return ( - -e "$ROOT$BASE_DIR/version_ofed" - && rpm_is_installed("ifs-kernel-updates", $CUR_OS_VER) - # MWHEINZ using stock iser. - # && installed_ofed_driver("ib_iser", "$driver_subdir", "drivers/infiniband/ulp/iser") - ); -} - -# only called if installed_ofed_iser is true -sub installed_version_ofed_iser() -{ - if ( -e "$ROOT$BASE_DIR/version_ofed" ) { - return `cat $ROOT$BASE_DIR/version_ofed`; - } else { - return ""; - } -} - -# only called if available_ofed_iser is true -sub media_version_ofed_iser() -{ - return media_version_ofed(); -} - -sub build_ofed_iser($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_ofed_iser($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('ofed_iser', $install_list, $installing_list)); -} - -sub preinstall_ofed_iser($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("ofed_iser", $install_list, $installing_list); -} - -sub install_ofed_iser($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('ofed_iser'); - install_ofed_comp('ofed_iser', $install_list); - - need_reboot(); - $ComponentWasInstalled{'ofed_iser'}=1; -} - -sub postinstall_ofed_iser($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - ofed_restore_autostart('ofed_iser'); -} - -sub uninstall_ofed_iser($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('ofed_iser'); - # TBD stop_ofed_iser; - uninstall_ofed_comp('ofed_iser', $install_list, $uninstalling_list, 'verbose'); - need_reboot(); - $ComponentWasInstalled{'ofed_iser'}=0; -} - -# ========================================================================== -# OFED ofed_nfsrdma installation - -# involves /etc/init.d/nfs and /etc/init.d/nfslock -# The HasStart is disabled, so these won't be called. -# TBD - If this is enabled, what return value to use and how should it -# interact with the two daemons -# should we treat nfs as a subcomponent much like we used to handle opamon? -# autostart functions are per subcomponent -sub IsAutostart2_ofed_nfsrdma() -{ - return IsAutostart("nfslock") || IsAutoStart("nfs"); -} -sub autostart_desc_ofed_nfsrdma() -{ - return "$ComponentInfo{'ofed_nfsrdma'}{'Name'}"; -} -sub enable_autostart2_ofed_nfsrdma() -{ - enable_autostart("nfslock"); - enable_autostart("nfs"); -} -sub disable_autostart2_ofed_nfsrdma() -{ - disable_autostart("nfs"); - disable_autostart("nfslock"); -} - -sub start_ofed_nfsrdma() -{ - my $driver_subdir=$ComponentInfo{'ofed_nfsrdma'}{'DriverSubdir'}; - start_driver($ComponentInfo{'ofed_nfsrdma'}{'Name'}, "lockd", "$driver_subdir/fs/lockd", "nfslock"); - start_driver($ComponentInfo{'ofed_nfsrdma'}{'Name'}, "nfs", "$driver_subdir/fs/nfs", "nfs"); -} - -sub stop_ofed_nfsrdma() -{ - stop_driver($ComponentInfo{'ofed_nfsrdma'}{'Name'}, "nfs", "nfs"); - stop_driver($ComponentInfo{'ofed_nfsrdma'}{'Name'}, "lockd", "nfslock"); -} - -sub available_ofed_nfsrdma() -{ - my $srcdir=$ComponentInfo{'ofed_nfsrdma'}{'SrcDir'}; - return ( (-d "$srcdir/SRPMS" || -d "$srcdir/RPMS") - && build_option_is_allowed($CUR_OS_VER, "--with-nfsrdma-mod", %ofed_kernel_ib_options)); -} - -sub installed_ofed_nfsrdma() -{ - my $driver_subdir=$ComponentInfo{'ofed_nfsrdma'}{'DriverSubdir'}; - return (#rpm_is_installed("rnfs-utils", "user") && - -e "$ROOT$BASE_DIR/version_ofed" - && rpm_is_installed("ifs-kernel-updates", $CUR_OS_VER) - # MWHEINZ using stock driver. - # && installed_ofed_driver("xprtrdma", "$driver_subdir", "net/sunrpc/xprtrdma") - ); -} - -# only called if installed_ofed_nfsrdma is true -sub installed_version_ofed_nfsrdma() -{ - if ( -e "$ROOT$BASE_DIR/version_ofed" ) { - return `cat $ROOT$BASE_DIR/version_ofed`; - } else { - return ""; - } -} - -# only called if available_ofed_nfsrdma is true -sub media_version_ofed_nfsrdma() -{ - return media_version_ofed(); -} - -sub build_ofed_nfsrdma($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_ofed_nfsrdma($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('ofed_nfsrdma', $install_list, $installing_list)); -} - -sub preinstall_ofed_nfsrdma($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("ofed_nfsrdma", $install_list, $installing_list); -} - -sub install_ofed_nfsrdma($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('ofed_nfsrdma'); - install_ofed_comp('ofed_nfsrdma', $install_list); - - need_reboot(); - $ComponentWasInstalled{'ofed_nfsrdma'}=1; -} - -sub postinstall_ofed_nfsrdma($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - # no need to restore_autostart, ofed reinstall does not affect nfs nor nfslock autostart -} - -sub uninstall_ofed_nfsrdma($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('ofed_nfsrdma'); - # TBD stop_ofed_nfsrdma; - uninstall_ofed_comp('ofed_nfsrdma', $install_list, $uninstalling_list, 'verbose'); - need_reboot(); - $ComponentWasInstalled{'ofed_nfsrdma'}=0; -} - -# ========================================================================== -# OFED ofed_iwarp installation - -# determine if the given capability is configured for Autostart at boot -sub IsAutostart2_ofed_iwarp() -{ - return IsAutostart_ofed_comp2('ofed_iwarp'); -} -sub autostart_desc_ofed_iwarp() -{ - return autostart_desc_ofed_comp('ofed_iwarp'); -} -# enable autostart for the given capability -sub enable_autostart2_ofed_iwarp() -{ - enable_autostart_ofed_comp2('ofed_iwarp'); -} -# disable autostart for the given capability -sub disable_autostart2_ofed_iwarp() -{ - disable_autostart_ofed_comp2('ofed_iwarp'); -} - -# these are not presently called, which is good since ofed is hard to do this -#sub start_ofed_iwarp() -#{ -# my $driver_subdir=$ComponentInfo{'ofed_iwarp'}{'DriverSubdir'}; -# start_driver($ComponentInfo{'ofed_iwarp'}{'Name'}, "ib_core", $driver_subdir, "openibd"); -#} - -#sub stop_ofed_iwarp() -#{ -# stop_driver($ComponentInfo{'ofed_iwarp'}{'Name'}, "ib_core", "openibd"); -#} - -sub available_ofed_iwarp() -{ - my $srcdir=$ComponentInfo{'ofed_iwarp'}{'SrcDir'}; - return ( (-d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ) - && (build_option_is_allowed($CUR_OS_VER, "--with-cxgb3-mod", %ofed_kernel_ib_options) - || build_option_is_allowed($CUR_OS_VER, "--with-cxgb4-mod", %ofed_kernel_ib_options) - || build_option_is_allowed($CUR_OS_VER, "--with-nes-mod", %ofed_kernel_ib_options))); -} - -sub installed_ofed_iwarp() -{ - my $driver_subdir=$ComponentInfo{'ofed_iwarp'}{'DriverSubdir'}; - return ((rpm_is_installed("libcxgb3", "user") - || rpm_is_installed("libcxgb4", "user") - || rpm_is_installed("libnes", "user")) - && -e "$ROOT$BASE_DIR/version_ofed" - && rpm_is_installed("ifs-kernel-updates", $CUR_OS_VER) - # MWHEINZ using stock drivers. - # && (installed_ofed_driver("iw_cxgb3", "$driver_subdir", "drivers/infiniband/hw/cxgb3") - # || installed_ofed_driver("iw_cxgb4", "$driver_subdir", "drivers/infiniband/hw/cxgb4") - # || installed_ofed_driver("iw_nes", "$driver_subdir", "drivers/infiniband/hw/nes")) - ); -} - -# only called if installed_ofed_iwarp is true -sub installed_version_ofed_iwarp() -{ - if ( -e "$ROOT$BASE_DIR/version_ofed" ) { - return `cat $ROOT$BASE_DIR/version_ofed`; - } else { - return ""; - } -} - -# only called if available_ofed_iwarp is true -sub media_version_ofed_iwarp() -{ - return media_version_ofed(); -} - -sub build_ofed_iwarp($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_ofed_iwarp($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('ofed_iwarp', $install_list, $installing_list)); -} - -sub preinstall_ofed_iwarp($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("ofed_iwarp", $install_list, $installing_list); -} - -sub install_ofed_iwarp($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('ofed_iwarp'); - install_ofed_comp('ofed_iwarp', $install_list); - - need_reboot(); - $ComponentWasInstalled{'ofed_iwarp'}=1; -} - -sub postinstall_ofed_iwarp($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - ofed_restore_autostart('ofed_iwarp'); -} - -sub uninstall_ofed_iwarp($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('ofed_iwarp'); - # TBD stop_ofed_iwarp; - uninstall_ofed_comp('ofed_iwarp', $install_list, $uninstalling_list, 'verbose'); - need_reboot(); - $ComponentWasInstalled{'ofed_iwarp'}=0; -} - -# ========================================================================== -# OFED opensm installation - -# determine if the given capability is configured for Autostart at boot -sub IsAutostart2_opensm() -{ - return IsAutostart_ofed_comp2('opensm'); -} -sub autostart_desc_opensm() -{ - return autostart_desc_ofed_comp('opensm'); -} -# enable autostart for the given capability -sub enable_autostart2_opensm() -{ - enable_autostart($ofed_comp_info{'opensm'}{'StartupScript'}); -} -# disable autostart for the given capability -sub disable_autostart2_opensm() -{ - disable_autostart($ofed_comp_info{'opensm'}{'StartupScript'}); -} - -sub start_opensm() -{ - my $prefix = ofed_get_prefix(); - start_utility($ComponentInfo{'opensm'}{'Name'}, "$prefix/sbin", "opensm", "opensmd"); -} - -sub stop_opensm() -{ - stop_utility($ComponentInfo{'opensm'}{'Name'}, "opensm", "opensmd"); -} - -sub available_opensm() -{ - my $srcdir=$ComponentInfo{'opensm'}{'SrcDir'}; - return ( -d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ); -} - -sub installed_opensm() -{ - return (rpm_is_installed("opensm", "user") - && -e "$ROOT$BASE_DIR/version_ofed"); -} - -# only called if installed_opensm is true -sub installed_version_opensm() -{ - if ( -e "$ROOT$BASE_DIR/version_ofed" ) { - return `cat $ROOT$BASE_DIR/version_ofed`; - } else { - return ""; - } -} - -# only called if available_opensm is true -sub media_version_opensm() -{ - return media_version_ofed(); -} - -sub build_opensm($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_opensm($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('opensm', $install_list, $installing_list)); -} - -sub preinstall_opensm($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("opensm", $install_list, $installing_list); -} - -sub install_opensm($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('opensm'); - install_ofed_comp('opensm', $install_list); - - $ComponentWasInstalled{'opensm'}=1; -} - -sub postinstall_opensm($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - ofed_restore_autostart('opensm'); -} - -sub uninstall_opensm($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('opensm'); - stop_opensm; - - uninstall_ofed_comp('opensm', $install_list, $uninstalling_list, 'verbose'); - $ComponentWasInstalled{'opensm'}=0; -} - -# ========================================================================== -# OFED ofed_debug installation - -# this is an odd component. It consists of the debuginfo files which -# are built and identified in DebugRpms in other components. Installing this -# component installs the debuginfo files for the installed components. -# uninstalling this component gets rid of all debuginfo files. -# uninstalling other components will get rid of individual debuginfo files -# for those components - -sub available_ofed_debug() -{ - my $srcdir=$ComponentInfo{'ofed_debug'}{'SrcDir'}; - return (( -d "$srcdir/SRPMS" || -d "$srcdir/RPMS") - && $ofed_rpm_info{'libibverbs-debuginfo'}{'Available'}); -} - -sub installed_ofed_debug() -{ - return (rpm_is_installed("libibverbs-debuginfo", "user") - && -e "$ROOT$BASE_DIR/version_ofed"); -} - -# only called if installed_ofed_debug is true -sub installed_version_ofed_debug() -{ - if ( -e "$ROOT$BASE_DIR/version_ofed" ) { - return `cat $ROOT$BASE_DIR/version_ofed`; - } else { - return ""; - } -} - -# only called if available_ofed_debug is true -sub media_version_ofed_debug() -{ - return media_version_ofed(); -} - -sub build_ofed_debug($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_ofed_debug($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - my $reins = need_reinstall_ofed_comp('ofed_debug', $install_list, $installing_list); - if ("$reins" eq "no" ) { - # if ofed components with DebugRpms have been added we need to reinstall - # this component. Note uninstall for individual components will - # get rid of associated debuginfo files - foreach my $comp ( @ofed_components ) { - if ( " $installing_list " =~ / $comp / - && 0 != scalar(@{ $ofed_comp_info{$comp}{'DebugRpms'}})) { - return "this"; - } - } - - } - return $reins; -} - -sub preinstall_ofed_debug($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("ofed_debug", $install_list, $installing_list); -} - -sub install_ofed_debug($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - my @list; - - print_install_banner_ofed_comp('ofed_debug'); - install_ofed_comp('ofed_debug', $install_list); - - # install DebugRpms for each installed component - foreach my $comp ( @ofed_components ) { - if ( " $install_list " =~ / $comp / ) { - ofed_rpm_install_list(ofed_rpms_dir(), $CUR_OS_VER, 1, - ( @{ $ofed_comp_info{$comp}{'DebugRpms'}})); - } - } - - $ComponentWasInstalled{'ofed_debug'}=1; -} - -sub postinstall_ofed_debug($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - #ofed_restore_autostart('ofed_debug'); -} - -sub uninstall_ofed_debug($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('ofed_debug'); - - uninstall_ofed_comp('ofed_debug', $install_list, $uninstalling_list, 'verbose'); - # uninstall debug rpms for all components - # debuginfo never in >1 component, so do explicit uninstall since - # have an odd PartOf relationship which confuses uninstall_not_needed_list - foreach my $comp ( reverse(@ofed_components) ) { - if ( "$comp" eq "ofed_ib_bonding" && ! $ofed_rpm_info{'ib-bonding'}{'Available'}) { - # skip, might be included with distro - } else { - rpm_uninstall_list("any", 'verbose', - @{ $ofed_comp_info{$comp}{'DebugRpms'}}); - } - } - $ComponentWasInstalled{'ofed_debug'}=0; -} - -# ========================================================================== -# OFED ibacm installation - -# determine if the given capability is configured for Autostart at boot -sub IsAutostart2_ibacm() -{ - return IsAutostart_ofed_comp2('ibacm'); -} -sub autostart_desc_ibacm() -{ - return autostart_desc_ofed_comp('ibacm'); -} -# enable autostart for the given capability -sub enable_autostart2_ibacm() -{ - enable_autostart($ofed_comp_info{'ibacm'}{'StartupScript'}); -} -# disable autostart for the given capability -sub disable_autostart2_ibacm() -{ - disable_autostart($ofed_comp_info{'ibacm'}{'StartupScript'}); -} - -sub start_ibacm() -{ - my $prefix = ofed_get_prefix(); - start_utility($ComponentInfo{'ibacm'}{'Name'}, "$prefix/sbin", "ibacm", "ibacm"); -} - -sub stop_ibacm() -{ - stop_utility($ComponentInfo{'ibacm'}{'Name'}, "ibacm", "ibacm"); -} - -sub available_ibacm() -{ - my $srcdir=$ComponentInfo{'ibacm'}{'SrcDir'}; - return ( -d "$srcdir/SRPMS" || -d "$srcdir/RPMS" ); -} - -sub installed_ibacm() -{ - return (rpm_is_installed("ibacm", "user") - && -e "$ROOT$BASE_DIR/version_ofed"); -} - -# only called if installed_ibacm is true -sub installed_version_ibacm() -{ - if ( -e "$ROOT$BASE_DIR/version_ofed" ) { - return `cat $ROOT$BASE_DIR/version_ofed`; - } else { - return ""; - } -} - -# only called if available_ibacm is true -sub media_version_ibacm() -{ - return media_version_ofed(); -} - -sub build_ibacm($$$$) -{ - my $osver = shift(); - my $debug = shift(); # enable extra debug of build itself - my $build_temp = shift(); # temp area for use by build - my $force = shift(); # force a rebuild - return 0; # success -} - -sub need_reinstall_ibacm($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return (need_reinstall_ofed_comp('ibacm', $install_list, $installing_list)); -} - -sub preinstall_ibacm($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - return preinstall_ofed("ibacm", $install_list, $installing_list); -} - -sub install_ibacm($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - - print_install_banner_ofed_comp('ibacm'); - install_ofed_comp('ibacm', $install_list); - - $ComponentWasInstalled{'ibacm'}=1; -} - -sub postinstall_ibacm($$) -{ - my $install_list = shift(); # total that will be installed when done - my $installing_list = shift(); # what items are being installed/reinstalled - ofed_restore_autostart('ibacm'); -} - -sub uninstall_ibacm($$) -{ - my $install_list = shift(); # total that will be left installed when done - my $uninstalling_list = shift(); # what items are being uninstalled - - print_uninstall_banner_ofed_comp('ibacm'); - stop_ibacm; - - uninstall_ofed_comp('ibacm', $install_list, $uninstalling_list, 'verbose'); - $ComponentWasInstalled{'ibacm'}=0; -} diff --git a/CommonInstall/comp_oftools.pl b/CommonInstall/comp_oftools.pl index cad560f2..d2c0b08d 100755 --- a/CommonInstall/comp_oftools.pl +++ b/CommonInstall/comp_oftools.pl @@ -49,13 +49,17 @@ sub stop_oftools sub available_oftools { +# TBD - could we move the algorithms for many of these functions into +# util_component.pl and simply put a list of rpms in the ComponentInfo +# as well as perhaps config files my $srcdir=$ComponentInfo{'oftools'}{'SrcDir'}; - return (rpm_resolve("$srcdir/RPMS/*/", "any", "opa-basic-tools") ne "" ); + return ((rpm_resolve("$srcdir/RPMS/*/", "any", "opa-basic-tools") ne "") + && (rpm_resolve("$srcdir/RPMS/*/", "any", "opa-address-resolution") ne "" )); } sub installed_oftools { - return(system("rpm -q --quiet opa-basic-tools") == 0) + return rpm_is_installed("opa-basic-tools", "any"); } # only called if installed_oftools is true @@ -69,7 +73,10 @@ sub installed_version_oftools sub media_version_oftools { my $srcdir=$ComponentInfo{'oftools'}{'SrcDir'}; - return `cat "$srcdir/version"`; + my $rpmfile = rpm_resolve("$srcdir/RPMS/*/", "any", "opa-basic-tools"); + my $version= rpm_query_version_release("$rpmfile"); + # assume media properly built with matching versions for all rpms + return dot_version("$version"); } sub build_oftools @@ -107,26 +114,19 @@ sub install_oftools my $version=media_version_oftools(); chomp $version; printf("Installing $ComponentInfo{'oftools'}{'Name'} $version $DBG_FREE...\n"); + # TBD - review all components and make installing messages the same #LogPrint "Installing $ComponentInfo{'oftools'}{'Name'} $version $DBG_FREE for $CUR_OS_VER\n"; LogPrint "Installing $ComponentInfo{'oftools'}{'Name'} $version $DBG_FREE for $CUR_DISTRO_VENDOR $CUR_VENDOR_VER\n"; - # Check $BASE_DIR directory ...exist - check_config_dirs(); - - check_dir("/usr/lib/opa/tools"); - check_dir("/usr/share/opa/samples"); - my $rpmfile = rpm_resolve("$srcdir/RPMS/*/", "any", "opa-basic-tools"); rpm_run_install($rpmfile, "any", " -U "); $rpmfile = rpm_resolve("$srcdir/RPMS/*/", "any", "opa-address-resolution"); rpm_run_install($rpmfile, "any", " -U "); +# TBD - could we figure out the list of config files from a query of rpm +# and then simply iterate on each config file? check_rpm_config_file("/etc/rdma/dsap.conf"); - ## Install OPA_SA_DB library, headers. - check_dir("/usr/include/infiniband"); - copy_shlib("$srcdir/bin/$ARCH/$CUR_DISTRO_VENDOR.$CUR_VENDOR_VER/lib/$DBG_FREE/libopasadb", "$LIB_DIR/libopasadb", "1.0.0"); - $ComponentWasInstalled{'oftools'}=1; } diff --git a/CommonInstall/comp_qlgc_fm.pl b/CommonInstall/comp_qlgc_fm.pl index 390045a9..47ab78dd 100755 --- a/CommonInstall/comp_qlgc_fm.pl +++ b/CommonInstall/comp_qlgc_fm.pl @@ -72,8 +72,7 @@ sub stop_opafm sub available_opafm { my $srcdir=$ComponentInfo{'opafm'}{'SrcDir'}; - my $rpmfile = file_glob("$srcdir/RPMS/*/opa-fm-*.rpm"); - return ( -d "$srcdir" && -e "$rpmfile" ); + return (rpm_resolve("$srcdir/RPMS/*/", "any", "opa-fm") ne ""); } sub installed_opafm @@ -85,19 +84,18 @@ sub installed_opafm # only called if installed_opafm is true sub installed_version_opafm { - my $fm_version = rpm_query_version_release_pkg("opa-fm"); - - return dot_version("$fm_version"); + my $version = rpm_query_version_release_pkg("opa-fm"); + return dot_version("$version"); } # only called if available_opafm is true sub media_version_opafm { my $srcdir=$ComponentInfo{'opafm'}{'SrcDir'}; - my $fm_rpmfile = file_glob("$srcdir/RPMS/*/opa-fm-*.rpm"); - my $fm_version= rpm_query_version_release("$fm_rpmfile"); + my $rpmfile = rpm_resolve("$srcdir/RPMS/*/", "any", "opa-fm"); + my $version= rpm_query_version_release("$rpmfile"); # assume media properly built with matching versions - return dot_version("$fm_version"); + return dot_version("$version"); } sub build_opafm diff --git a/CommonInstall/do_mvapich2_build.sh b/CommonInstall/do_mvapich2_build.sh index 22721321..8587844a 100755 --- a/CommonInstall/do_mvapich2_build.sh +++ b/CommonInstall/do_mvapich2_build.sh @@ -60,7 +60,21 @@ # rebuild MVAPICH2 to target a specific compiler -PREREQ=("libibverbs-devel" "librdmacm-devel" "mpi-selector") +ID="" +VERSION_ID="" + +if [ -e /etc/os-release ]; then + . /etc/os-release +else + echo /etc/os-release is not available !!! +fi + +if [[ ( "$ID" == "rhel" && $(echo "$VERSION_ID > 7.3" | bc -l) == 1 ) || \ + ( "$ID" == "sles" && $(echo "$VERSION_ID > 12.2" | bc -l) == 1 ) ]]; then + PREREQ=("rdma-core-devel" "mpi-selector") +else + PREREQ=("libibverbs-devel" "librdmacm-devel" "mpi-selector") +fi CheckPreReqs() { @@ -334,7 +348,7 @@ case $interface in # PSM indicated by qlc suffix so user can ID PSM vs verbs MPIs mvapich2_path_suffix="-hfi" mvapich2_rpm_suffix="_hfi" - PREREQ+=("libpsm2") + PREREQ+=("libpsm2-devel") else # PSM indicated by qlc suffix so user can ID PSM vs verbs MPIs mvapich2_path_suffix="-qlc" diff --git a/CommonInstall/do_openmpi_build.sh b/CommonInstall/do_openmpi_build.sh index ff9c2642..d882fd35 100755 --- a/CommonInstall/do_openmpi_build.sh +++ b/CommonInstall/do_openmpi_build.sh @@ -1,11 +1,11 @@ #!/bin/bash # BEGIN_ICS_COPYRIGHT8 **************************************** -# -# Copyright (c) 2015, Intel Corporation -# +# +# Copyright (c) 2017, Intel Corporation +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: -# +# # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright @@ -14,7 +14,7 @@ # * Neither the name of Intel Corporation nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. -# +# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -25,7 +25,7 @@ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# +# # END_ICS_COPYRIGHT8 **************************************** # This file incorporates work covered by the following copyright and permission notice @@ -60,7 +60,21 @@ # rebuild OpenMPI to target a specific compiler -PREREQ=("libibverbs-devel" "librdmacm-devel" "mpi-selector") +ID="" +VERSION_ID="" + +if [ -e /etc/os-release ]; then + . /etc/os-release +else + echo /etc/os-release is not available !!! +fi + +if [[ ( "$ID" == "rhel" && $(echo "$VERSION_ID > 7.3" | bc -l) == 1 ) || \ + ( "$ID" == "sles" && $(echo "$VERSION_ID > 12.2" | bc -l) == 1 ) ]]; then + PREREQ=("rdma-core-devel" "mpi-selector") +else + PREREQ=("libibverbs-devel" "librdmacm-devel" "mpi-selector") +fi CheckPreReqs() { @@ -86,7 +100,7 @@ CheckPreReqs() fi echo exit 2 - fi + fi } Usage() @@ -95,7 +109,7 @@ Usage() echo " -d - use default settings for openmpi options" >&2 echo " if omitted, will be prompted for each option" >&2 echo " -Q - build the MPI targeted for the PSM API." >&2 - echo " -O - build the MPI targeted for the Omnipath HFI PSM API." >&2 + echo " -O - build the MPI targeted for the Omni-path HFI PSM2 and OFI API." >&2 echo " -C - build the MPI targeted for the Omnipath HFI PSM with CUDA." >&2 echo " config_opt - a compiler selection option (gcc, pathscale, pgi or intel)" >&2 echo " if config_opt is not specified, the user will be prompted" >&2 @@ -288,7 +302,7 @@ then if rpm -qa|grep libpsm2 >/dev/null 2>&1 then echo - get_yes_no "Build for Omnipath HFI PSM" "y" + get_yes_no "Build for Omnipath HFI PSM2 and OFI" "y" if [ "$ans" = 1 ] then Oflag=y @@ -312,7 +326,7 @@ fi if [ "$Qflag" = y ] then PREREQ+=('infinipath-devel') - + openmpi_conf_psm= # PSM indicated by qlc suffix so user can ID PSM vs verbs MPIs openmpi_path_suffix="-qlc" @@ -320,16 +334,21 @@ then interface=psm elif [ "$Oflag" = y ] then - PREREQ+=('libpsm2') - - openmpi_conf_psm='--with-psm=/usr --with-psm2=/usr --disable-oshmem' + PREREQ+=('libpsm2-devel') + if [[ -f /etc/redhat-release && ($(cat /etc/redhat-release | grep 6.7) ) ]]; then + openmpi_conf_psm='--with-psm=/usr --with-psm2=/usr --disable-oshmem' + else + PREREQ+=('libfabric-devel') + openmpi_conf_psm='--with-psm=/usr --with-psm2=/usr --disable-oshmem --with-libfabric=/usr' + fi + # PSM indicated by qlc suffix so user can ID PSM vs verbs MPIs openmpi_path_suffix="-hfi" openmpi_rpm_suffix="_hfi" interface=psm elif [ "$Cflag" = y ] then - PREREQ+=('libpsm2' 'cuda') + PREREQ+=('libpsm2-devel' 'cuda') openmpi_conf_psm='--with-psm=/usr --with-psm2=/usr --disable-oshmem --with-cuda=/usr/local/cuda' # PSM indicated by qlc suffix so user can ID PSM vs verbs MPIs @@ -642,7 +661,7 @@ logfile=make.openmpi.$interface.$compiler echo "error: mpitests_openmpi_$compiler$openmpi_rpm_suffix Build ERROR: bad exit code" exit 1 fi - + if [ "$iflag" = n ] then mv $RPM_DIR/RPMS/$target_cpu/mpitests_openmpi_$compiler$openmpi_rpm_suffix-$mpitests_fullversion.$target_cpu.rpm $DESTDIR diff --git a/CommonInstall/main_delta.pl b/CommonInstall/main_delta.pl deleted file mode 100755 index 28c9c0ca..00000000 --- a/CommonInstall/main_delta.pl +++ /dev/null @@ -1,1215 +0,0 @@ -#!/usr/bin/perl -# BEGIN_ICS_COPYRIGHT8 **************************************** -# -# Copyright (c) 2015, Intel Corporation -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# END_ICS_COPYRIGHT8 **************************************** - -# [ICS VERSION STRING: unknown] -use strict; -#use Term::ANSIColor; -#use Term::ANSIColor qw(:constants); -#use File::Basename; -#use Math::BigInt; - -# =========================================================================== -# Main menus, option handling and version handling for OFED DELTA install -# - -$MainInstall="delta"; - -@supported_kernels = ( $CUR_OS_VER ); # TBD how do we verify OS -my $Build_OsVer=$CUR_OS_VER; -my $Build_Debug=0; # should we provide more info for debug -my $Build_Temp=""; # temp area to use for build -my $Default_Build = 0; # -B option used to select build -my $Build_Force = 0;# rebuild option used to force full rebuild - -$FirstIPoIBInterface=0; # first device is ib0 - - # Names of supported install components - # must be listed in depdency order such that prereqs appear 1st -# TBD ofed_vnic -my @Components_other = ( "opa_stack", "ibacm", "intel_hfi", "mpi_selector", - "delta_ipoib", - "opa_stack_dev", - "gasnet", "openshmem", - "mvapich2", "openmpi", - "delta_mpisrc", - "hfi1_uefi", - "delta_debug", ); -my @Components_rhel72 = ( "opa_stack", "ibacm", "intel_hfi", "mpi_selector", - "delta_ipoib", - "opa_stack_dev", - "gasnet", "openshmem", - "mvapich2", "openmpi", - "delta_mpisrc", - "hfi1_uefi", - "delta_debug", ); -my @Components_sles12_sp2 = ( "opa_stack", "intel_hfi", "mpi_selector", - "delta_ipoib", - "opa_stack_dev", - "gasnet", "openshmem", - "mvapich2", "openmpi", - "delta_mpisrc", - "hfi1_uefi", - "delta_debug", ); -@Components = ( ); -# delta_debug must be last - -@SubComponents = ( ); - - # an additional "special" component which is always installed when - # we install/upgrade anything and which is only uninstalled when everything - # else has been uninstalled. Typically this will be the opaconfig - # file and related files absolutely required by it (such as wrapper_version) -$WrapperComponent = "opa_config_delta"; - -# This provides more detailed information about each Component in @Components -# since hashes are not retained in the order specified, we still need -# @Components and @SubComponents to control install and menu order -# Fields are as follows: -# Name => full name of component/subcomponent for prompts -# DefaultInstall => default installation (State_DoNotInstall or State_Install) -# used only when available and ! installed -# SrcDir => directory name within install media for component -# DriverSubdir => directory within /lib/modules/$CUR_OS_VERSION/ to -# install driver to. Set to "" if no drivers in component -# set to "." if no subdir -# PreReq => other components which are prereqs of a given -# component/subcomponent -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# CoReq => other components which are coreqs of a given component -# Note that CoReqs can also be listed as prereqs to provide -# install verification as each component is installed, -# however prereqs should only refer to items earlier in the list -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# Hidden => component should not be shown in menus/prompts -# used for hidden PreReq. Hidden components can't HasStart -# nor HasFirmware -# Disabled => components/subcomponents which are disabled from installation -# HasStart => components/subcomponents which have autostart capability -# DefaultStart => should autostart default to Enable (1) or Disable (0) -# Not needed/ignored unless HasStart=1 -# StartPreReq => other components/subcomponents which must be autostarted -# before autostarting this component/subcomponent -# Not needed/ignored unless HasStart=1 -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# StartComponents => components/subcomponents with start for this component -# if a component has a start script -# list the component as a subcomponent of itself -# HasFirmware => components which need HCA firmware update after installed -# -# Note both Components and SubComponents are included in the list below. -# Components require all fields be supplied -# SubComponents only require the following fields: -# Name, PreReq (should reference only components), HasStart, StartPreReq, -# DefaultStart -my %ComponentInfo_other = ( - # our special WrapperComponent, limited use - "opa_config_delta" => { Name => "opa_config_delta", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => "", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opa_stack" => { Name => "OFA OPA Stack", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => "", CoReq => "", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => "", - StartComponents => [ "opa_stack" ], - }, - "ibacm" => { Name => "OFA IBACM", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ "ibacm" ], - }, - "intel_hfi" => { Name => "Intel HFI Components", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "intel_hfi" ], - }, - "mpi_selector" => { Name => "MPI selector", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 1, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "delta_ipoib" => { Name => "OFA IP over IB", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "delta_ipoib" ], - }, - "mvapich2" => { Name => "MVAPICH2 (verbs,gcc)", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi" => { Name => "OpenMPI (verbs,gcc)", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "gasnet" => { Name => "Gasnet HFI (gcc)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openshmem" => { Name => "OpenSHMEM HFI (gcc)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack gasnet", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opa_stack_dev" => { Name => "OFA OPA Development", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "delta_mpisrc" =>{ Name => "MPI Source", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack opa_stack_dev mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "delta_debug" =>{ Name => "OFA Debug Info", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "hfi1_uefi" => { Name => "Pre-Boot Components", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - ); - -my %ComponentInfo_rhel72 = ( - # our special WrapperComponent, limited use - "opa_config_delta" => { Name => "opa_config_delta", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => "", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opa_stack" => { Name => "OFA OPA Stack", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "extra/ifs-kernel-updates", - PreReq => "", CoReq => "", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => "", - StartComponents => [ "opa_stack" ], - }, - "ibacm" => { Name => "OFA IBACM", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ "ibacm" ], - }, - "intel_hfi" => { Name => "Intel HFI Components", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "intel_hfi" ], - }, - "mpi_selector" => { Name => "MPI selector", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 1, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "delta_ipoib" => { Name => "OFA IP over IB", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "delta_ipoib" ], - }, - "mvapich2" => { Name => "MVAPICH2 (verbs,gcc)", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi" => { Name => "OpenMPI (verbs,gcc)", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "gasnet" => { Name => "Gasnet HFI (gcc)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openshmem" => { Name => "OpenSHMEM HFI (gcc)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack gasnet", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opa_stack_dev" => { Name => "OFA OPA Development", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "delta_mpisrc" =>{ Name => "MPI Source", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack opa_stack_dev mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "delta_debug" =>{ Name => "OFA Debug Info", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "hfi1_uefi" => { Name => "Pre-Boot Components", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - ); - -my %ComponentInfo_sles12_sp2 = ( - # our special WrapperComponent, limited use - "opa_config_delta" => { Name => "opa_config_delta", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => "", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opa_stack" => { Name => "OFA OPA Stack", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates/ifs-kernel-updates", - PreReq => "", CoReq => "", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => "", - StartComponents => [ "opa_stack" ], - }, - "intel_hfi" => { Name => "Intel HFI Components", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "intel_hfi" ], - }, - "mpi_selector" => { Name => "MPI selector", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 1, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "delta_ipoib" => { Name => "OFA IP over IB", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "delta_ipoib" ], - }, - "mvapich2" => { Name => "MVAPICH2 (verbs,gcc)", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi" => { Name => "OpenMPI (verbs,gcc)", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "gasnet" => { Name => "Gasnet HFI (gcc)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openshmem" => { Name => "OpenSHMEM HFI (gcc)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack gasnet", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opa_stack_dev" => { Name => "OFA OPA Development", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "delta_mpisrc" =>{ Name => "MPI Source", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack opa_stack_dev mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "delta_debug" =>{ Name => "OFA Debug Info", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "hfi1_uefi" => { Name => "Pre-Boot Components", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - ); - - -%ComponentInfo = ( ); - - # translate from startup script name to component/subcomponent name -%StartupComponent = ( - "opa" => "opa_stack", - "ipoib" => "ipoib", - ); - # has component been loaded since last configured autostart -%ComponentWasInstalled = ( - "opa_stack" => 0, - "intel_hfi" => 0, - "mpi_selector" => 0, - "opa_stack_dev" => 0, - "delta_ipoib" => 0, - "mvapich2" => 0, - "openmpi" => 0, - "gasnet" => 0, - "openshmem" => 0, - "delta_mpisrc" => 0, - "ibacm" => 0, - "hfi1_uefi" => 0, - "delta_debug" => 0, - ); - -sub init_components -{ - if ( "$CUR_VENDOR_VER" eq "ES72" ) { - @Components = ( @Components_rhel72 ); - %ComponentInfo = ( %ComponentInfo_rhel72 ); - } elsif ( "$CUR_VENDOR_VER" eq "ES122" ) { - @Components = ( @Components_sles12_sp2 ); - %ComponentInfo = ( %ComponentInfo_sles12_sp2 ); - } else { - @Components = ( @Components_other ); - %ComponentInfo = ( %ComponentInfo_other ); - } -} - -# ========================================================================== -# opa_config_delta installation -# This is a special WrapperComponent which only needs: -# available, install and uninstall -# it cannot have startup scripts, dependencies, prereqs, etc - -sub available_opa_config_delta -{ - my $srcdir=$ComponentInfo{'opa_config_delta'}{'SrcDir'}; - return ( -e "$srcdir/INSTALL" ); -} - -sub install_opa_config_delta -{ - my $install_list = $_[0]; # total that will be installed when done - my $installing_list = $_[1]; # what items are being installed/reinstalled - - my $srcdir=$ComponentInfo{'opa_config_delta'}{'SrcDir'}; - NormalPrint("Installing $ComponentInfo{'opa_config_delta'}{'Name'}...\n"); - - check_config_dirs(); - copy_systool_file("$srcdir/INSTALL", "/sbin/opa_config_delta"); - # no need for a version file, ofed delta will have its own - - # if IFS OFED is not installed, create opa_config too - if ( ! -e "$BASE_DIR/version_wrapper" ) { - copy_systool_file("$srcdir/INSTALL", "/sbin/opaconfig"); - } - - $ComponentWasInstalled{'opa_config_delta'}=1; -} - -sub uninstall_opa_config_delta -{ - my $install_list = $_[0]; # total that will be left installed when done - my $uninstalling_list = $_[1]; # what items are being uninstalled - - NormalPrint("Uninstalling $ComponentInfo{'opa_config_delta'}{'Name'}...\n"); - system("rm -rf $ROOT/sbin/opa_config_delta"); - # if IFS OFED is not installed, remove opaconfig too - if ( ! -e "$BASE_DIR/version_wrapper" ) { - system("rm -rf $ROOT/sbin/opaconfig"); - } - $ComponentWasInstalled{'opa_config_delta'}=0; -} - -my $allow_install; -if ( my_basename($0) ne "INSTALL" ) -{ - if ( my_basename($0) eq "ics_ib" ) - { - printf("Warning: ics_ib is depricated, use opaconfig\n"); - HitKeyCont; - } - $allow_install=0; -} else { - $allow_install=1; -} - -# -# Check if all basic requirements are ok -# -sub verify_os_ver -{ - #my $supported_kernel; - # - #if (!$allow_install) - #{ - # my $catkernels = `cat $ROOT$BASE_DIR/supported_kernels`; - # @supported_kernels = split( / +/, $catkernels); - #} else { - # system("echo -n @supported_kernels > ./config/supported_kernels"); - #} - # - #foreach my $supported_kernel_path ( @supported_kernels ) - #{ - # $supported_kernel = my_basename($supported_kernel_path); - # - # $module_dirs[++$#module_dirs] = "/lib/modules/$supported_kernel"; - #} - # make sure current OS version included so remove_driver works - $module_dirs[++$#module_dirs] = "/lib/modules/$CUR_OS_VER"; -} - -sub Usage -{ - if ( $allow_install ) { - #printf STDERR "Usage: $0 [-r root] [-v|-vv] -R osver -B osver [-d][-t tempdir] [--user_configure_options 'options'] [--kernel_configure_options 'options'] [--prefix dir] [--without-depcheck] [--rebuild] [--force] [--answer keyword=value] [--debug]\n"; - #printf STDERR " or\n"; - #printf STDERR "Usage: $0 [-r root] [-v|-vv] [-a|-n|-U|-u|-s|-i comp|-e comp] [-E comp] [-D comp] [-l] [--user_configure_options 'options'] [--kernel_configure_options 'options'] [--prefix dir] [--without-depcheck] [--rebuild] [--force] [--answer keyword=value] [--debug]\n"; - #printf STDERR "Usage: $0 [-r root] [-v|-vv] [-a|-n|-U|-u|-s|-i comp|-e comp|-E comp|-D comp] [--user_configure_options 'options'] [--kernel_configure_options 'options'] [--prefix dir] [--without-depcheck] [--rebuild] [--force] [--answer=value]\n"; - printf STDERR "Usage: $0 [-r root] [-v|-vv] -R osver -B osver [-a|-n|-U|-u|-s|-O|-N|-i comp|-e comp|-E comp|-D comp] [--user_configure_options 'options'] [--kernel_configure_options 'options'] [--prefix dir] [--without-depcheck] [--rebuild] [--force] [--answer=value]\n"; - } else { - printf STDERR "Usage: $0 [-r root] [-v|-vv] [-u|-s|-e comp] [-E comp] [-D comp] [--answer=value]\n"; - printf STDERR " [--user_queries|--no_user_queries]\n"; - } - printf STDERR " or\n"; - printf STDERR "Usage: $0 -C\n"; - printf STDERR " or\n"; - printf STDERR "Usage: $0 -V\n"; - if ( $allow_install ) { - printf STDERR " -a - install all ULPs and drivers with default options\n"; - printf STDERR " -n - install all ULPs and drivers with default options\n"; - printf STDERR " but with no change to autostart options\n"; - printf STDERR " -U - upgrade/re-install all presently installed ULPs and drivers with\n"; - printf STDERR " default options and no change to autostart options\n"; - printf STDERR " -i comp - install the given component with default options\n"; - printf STDERR " can appear more than once on command line\n"; - #printf STDERR " -l - skip creating/removing symlinks to /usr/local from /usr/lib/opa\n"; - printf STDERR " --user_configure_options 'options' - specify additional OFA build\n"; - printf STDERR " options for user space srpms. Causes rebuild of all user srpms\n"; - printf STDERR " --kernel_configure_options 'options' - specify additional OFA build\n"; - printf STDERR " options for driver srpms. Causes rebuild of all driver srpms\n"; - printf STDERR " --prefix dir - specify alternate directory prefix for install\n"; - printf STDERR " default is /usr. Causes rebuild of needed srpms\n"; - printf STDERR " --without-depcheck - disable check of OS dependencies\n"; - printf STDERR " --rebuild - force OFA Delta rebuild\n"; - printf STDERR " --force - force install even if distos don't match\n"; - printf STDERR " Use of this option can result in undefined behaviors\n"; - printf STDERR " -O - Keep current modified rpm config file\n"; - printf STDERR " -N - Use new default rpm config file\n"; - # --debug, -B, -t and -d options are purposely not documented - #printf STDERR " --debug - build a debug version of modules\n"; - printf STDERR " -B osver - run build for all components targetting kernel osver\n"; - #printf STDERR " -t - temp area for use by builds, only valid with -B\n"; - #printf STDERR " -d - enable build debugging assists, only valid with -B\n"; - printf STDERR " -R osver - force install for kernel osver rather than running kernel.\n"; - } - printf STDERR " -u - uninstall all ULPs and drivers with default options\n"; - printf STDERR " -s - enable autostart for all installed drivers\n"; - printf STDERR " -r - specify alternate root directory, default is /\n"; - printf STDERR " -e comp - uninstall the given component with default options\n"; - printf STDERR " can appear more than once on command line\n"; - printf STDERR " -E comp - enable autostart of given component\n"; - printf STDERR " can appear with -D or more than once on command line\n"; - printf STDERR " -D comp - disable autostart of given component\n"; - printf STDERR " can appear with -E or more than once on command line\n"; - printf STDERR " -v - verbose logging\n"; - printf STDERR " -vv - very verbose debug logging\n"; - printf STDERR " -C - output list of supported components\n"; - printf STDERR " -V - output Version\n"; - - printf STDERR " --user_queries - permit non-root users to query the fabric. (default)\n"; - printf STDERR " --no_user_queries - non root users cannot query the fabric.\n"; - showAnswerHelp(); - - printf STDERR " default options retain existing configuration files\n"; - printf STDERR " supported component names:\n"; - printf STDERR " "; - foreach my $comp ( @Components ) - { - printf STDERR " $comp"; - } - printf STDERR "\n"; - printf STDERR " supported component name aliases:\n"; - printf STDERR " mpi verbs_mpi pgas mpisrc opadev\n"; - if (scalar(@SubComponents) > 0) { - printf STDERR " additional component names allowed for -E and -D options:\n"; - printf STDERR " "; - foreach my $comp ( @SubComponents ) - { - printf STDERR " $comp"; - } - printf STDERR "\n"; - } - exit (2); -} - -# translate an ibaccess component name into the corresponding list of ofed delta comps -# if the given name is invalid or has no corresponding OFED component -# returns an empty list -sub translate_comp -{ - my($arg)=$_[0]; - if ("$arg" eq "opadev") { return ( "opa_stack_dev" ); - } elsif ("$arg" eq "mpi") { return ( "mvapich2", "openmpi" ); - } elsif ("$arg" eq "verbs_mpi") { return ( "mvapich2", "openmpi" ); - } elsif ("$arg" eq "pgas") { return ( "gasnet", "openshmem" ); - } elsif ("$arg" eq "mpisrc") { return ( "delta_mpisrc" ); - # no ibaccess argument equivalent for: ofed_srpt, ofed_iser, - # openmpi, ofed_iwarp, opensm, ofed_nfsrdma, delta_debug - # - } else { - return (); # invalid name - } -} - -sub process_args -{ - my $arg; - my $last_arg; - my $setroot = 0; - my $install_opt = 0; - my $setcomp = 0; - my $setenabled = 0; - my $setdisabled = 0; - my $setosver = 0; - my $setbuildtemp = 0; - my $comp = 0; - my $osver = 0; - my $setuseroptions = 0; - my $setcurosver = 0; - my $setkerneloptions = 0; - my $setprefix = 0; - my $setanswer = 0; - my $patch_ofed=0; - - if (scalar @ARGV >= 1) { - foreach $arg (@ARGV) { - if ( $setroot ) { - $ROOT="$arg"; - if (substr($ROOT,0,1) ne "/") { - printf STDERR "Invalid -r root (must be absolute path): '$ROOT'\n"; - Usage; - } - if (! -d $ROOT) { - printf STDERR "Invalid -r root (directory not found): '$ROOT'\n"; - Usage; - } - $setroot=0; - } elsif ( $setanswer ) { - my @pair = split /=/,$arg; - if ( scalar(@pair) != 2 ) { - printf STDERR "Invalid --answer keyword=value: '$arg'\n"; - Usage; - } - set_answer($pair[0], $pair[1]); - $setanswer=0; - } elsif ( $setcomp ) { - foreach $comp ( @Components ) - { - if ( "$arg" eq "$comp" ) - { - $Default_Components{$arg} = 1; - $setcomp=0; - } - } - if ( $setcomp ) - { - my @comps = translate_comp($arg); - # if empty list returned, we will not clear setcomp and - # will get error below - foreach $comp ( @comps ) - { - $Default_Components{$comp} = 1; - $setcomp=0; - } - } - if ( $setcomp ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( $setenabled ) { - foreach $comp ( @Components, @SubComponents ) - { - if ( "$arg" eq "$comp" ) - { - $Default_EnabledComponents{$arg} = 1; - $setenabled=0; - } - } - if ( $setenabled ) - { - my @comps = translate_comp($arg); - # if empty list returned, we will not clear setcomp and - # will get error below - foreach $comp ( @comps ) - { - $Default_EnabledComponents{$comp} = 1; - $setenabled=0; - } - } - if ( $setenabled ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( $setdisabled ) { - foreach $comp ( @Components, @SubComponents ) - { - if ( "$arg" eq "$comp" ) - { - $Default_DisabledComponents{$arg} = 1; - $setdisabled=0; - } - } - if ( $setdisabled ) - { - my @comps = translate_comp($arg); - # if empty list returned, we will not clear setcomp and - # will get error below - foreach $comp ( @comps ) - { - $Default_DisabledComponents{$comp} = 1; - $setdisabled=0; - } - } - if ( $setdisabled ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( $setosver ) { - $Build_OsVer="$arg"; - $setosver=0; - } elsif ( $setbuildtemp ) { - $Build_Temp="$arg"; - $setbuildtemp=0; - } elsif ( $setuseroptions ) { - $OFED_user_configure_options="$arg"; - $setuseroptions=0; - } elsif ( $setkerneloptions ) { - $OFED_kernel_configure_options="$arg"; - $setkerneloptions=0; - } elsif ( $setprefix ) { - $OFED_prefix="$arg"; - $setprefix=0; - } elsif ( $setcurosver ) { - $CUR_OS_VER="$arg"; - @supported_kernels = ( $CUR_OS_VER ); - $setcurosver=0; - } elsif ( "$arg" eq "-r" ) { - $setroot=1; - } elsif ( "$arg" eq "-v" ) { - $LogLevel=1; - } elsif ( "$arg" eq "-vv" ) { - $LogLevel=2; - } elsif ( "$arg" eq "-i" ) { - $Default_CompInstall=1; - $Default_Prompt=1; - $setcomp=1; - if ($install_opt || $Default_CompUninstall || $Default_Build) { - # can't mix -i with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-e" ) { - $Default_CompUninstall=1; - $Default_Prompt=1; - $setcomp=1; - if ($install_opt || $Default_CompInstall || $Default_Build) { - # can't mix -e with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-E" ) { - $Default_Autostart=1; - $Default_EnableAutostart=1; - $Default_Prompt=1; - $setenabled=1; - if ($Default_Build) { - # can't mix -E with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-D" ) { - $Default_Autostart=1; - $Default_DisableAutostart=1; - $Default_Prompt=1; - $setdisabled=1; - if ($Default_Build) { - # can't mix -D with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "--user_configure_options" ) { - $setuseroptions=1; - } elsif ( "$arg" eq "--kernel_configure_options" ) { - $setkerneloptions=1; - } elsif ( "$arg" eq "--prefix" ) { - $setprefix=1; - } elsif ( "$arg" eq "--answer" ) { - $setanswer=1; - } elsif ( "$arg" eq "--without-depcheck" ) { - $rpm_check_dependencies=0; - } elsif ( "$arg" eq "--force" ) { - $Force_Install=1; - } elsif ( "$arg" eq "-C" ) { - ShowComponents; - exit(0); - } elsif ( "$arg" eq "-V" ) { - printf "$VERSION\n"; - exit(0); - } elsif ( "$arg" eq "-R" ) { - $setcurosver=1; - } elsif ( "$arg" eq "-B" ) { - # undocumented option to do a build for specific OS - $Default_Build=1; - $Default_Prompt=1; - $setosver=1; - if ($install_opt || $Default_CompInstall || $Default_CompUninstall || $Default_Autostart) { - # can't mix -B with install - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-d" ) { - # undocumented option to aid debug of build - $Build_Debug=1; - if ($install_opt || $Default_CompInstall || $Default_CompUninstall || $Default_Autostart) { - # can't mix -d with install - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-t" ) { - # undocumented option to aid debug of build - $setbuildtemp=1; - if ($install_opt || $Default_CompInstall || $Default_CompUninstall || $Default_Autostart) { - # can't mix -t with install - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "--rebuild" ) { - # force rebuild - $Build_Force=1; - $OFED_force_rebuild=1; - } elsif ( "$arg" eq "--debug" ) { - $OFED_debug=1; - } elsif ( "$arg" eq "--user_queries" ) { - $Default_UserQueries=1; - } elsif ( "$arg" eq "--no_user_queries" ) { - $Default_UserQueries=-1; - } elsif ( "$arg" eq "--patch_ofed" ) { - $patch_ofed=1; - } else { - # Install options - if ( "$arg" eq "-a" ) { - $Default_Install=1; - } elsif ( "$arg" eq "-u" ) { - $Default_Uninstall=1; - } elsif ( "$arg" eq "-s" ) { - $Default_Autostart=1; - } elsif ( "$arg" eq "-n" ) { - $Default_Install=1; - $Default_SameAutostart=1; - } elsif ( "$arg" eq "-U" ) { - $Default_Upgrade=1; - $Default_SameAutostart=1; - } elsif ("$arg" eq "-O") { - $Default_RpmConfigKeepOld=1; - $Default_RpmConfigUseNew=0; - } elsif ("$arg" eq "-N") { - $Default_RpmConfigKeepOld=0; - $Default_RpmConfigUseNew=1; - } else { - printf STDERR "Invalid option: $arg\n"; - Usage; - } - if ($install_opt || $Default_CompInstall - || $Default_CompUninstall) { - # only one of the above install selections - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - $install_opt=1; - $Default_Prompt=1; - } - $last_arg=$arg; - } - } - if ( $setroot || $setcomp || $setenabled || $setdisabled || $setosver || $setbuildtemp || $setuseroptions || $setkerneloptions || $setprefix || $setanswer) { - printf STDERR "Missing argument for option: $last_arg\n"; - Usage; - } - if ( ($Default_Install || $Default_CompInstall || $Default_Upgrade - || $Force_Install) - && ! $allow_install) { - printf STDERR "Installation options not permitted in this mode\n"; - Usage; - } - if ( ($Default_Build || $OFED_force_rebuild || $OFED_debug - || ($OFED_user_configure_options ne '') - || ($OFED_kernel_configure_options ne '') - || ($OFED_prefix ne '/usr')) - && ! $allow_install) { - printf STDERR "Build options not permitted in this mode\n"; - Usage; - } - if ( $patch_ofed) { - NormalPrint("Patching OFA...\n"); - LogPrint("Executing: cd $ComponentInfo{'opa_stack'}{'SrcDir'}; ./patch_ofed3\n"); - system("cd $ComponentInfo{'opa_stack'}{'SrcDir'}; ./patch_ofed3"); - HitKeyCont; - } -} - -my @INSTALL_CHOICES= (); -sub show_menu -{ - my $inp; - my $max_inp; - - @INSTALL_CHOICES= (); - if ( $Default_Install ) { - NormalPrint ("Installing All OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ( $Default_CompInstall ) { - NormalPrint ("Installing Selected OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ( $Default_Upgrade ) { - NormalPrint ("Upgrading/Re-Installing OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ( $Default_Uninstall ) { - NormalPrint ("Uninstalling All OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 4); - } - if ($Default_CompUninstall ) { - NormalPrint ("Uninstalling Selected OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 4); - } - if ($Default_Autostart) { - NormalPrint ("Configuring autostart for Selected installed OPA Drivers\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 3); - } - if (scalar(@INSTALL_CHOICES) > 0) { - return; - } -START: - system "clear"; - printf ("$BRAND OPA $VERSION Software\n\n"); - if ($allow_install) { - printf (" 1) Install/Uninstall Software\n"); - } else { - printf (" 1) Show Installed Software\n"); - } - printf (" 2) Reconfigure $ComponentInfo{'delta_ipoib'}{'Name'}\n"); - printf (" 3) Reconfigure Driver Autostart \n"); - $max_inp=3; - if (!$allow_install) - { - printf (" 4) Uninstall Software\n"); - $max_inp=4; - } - printf ("\n X) Exit\n"); - - - $inp = getch(); - - if ($inp =~ /[qQ]/ || $inp =~ /[Xx]/ ) { - @INSTALL_CHOICES = ( 99999 ); # indicates exit, none selected - return; - } - if (ord($inp) == $KEY_ENTER) { - goto START; - } - - if ($inp =~ /[0123456789abcdefABCDEF]/) - { - $inp = hex($inp); - } - - if ($inp < 1 || $inp > $max_inp) - { -# printf ("Invalid choice...Try again\n"); - goto START; - } - @INSTALL_CHOICES = ( $inp ); -} - -determine_os_version; -init_components; - -process_args; -check_root_user; -if ( ! $Default_Build ) { - open_log(""); -} else { - open_log("./build.log"); -} - -if ( ! $Default_Build ) { - verify_os_ver; - verify_modtools; - #if ($allow_install) { - # verify_distrib_files; - #} -} - -set_libdir; -init_delta_rpm_info($CUR_OS_VER); - -RESTART: -if ($Default_Build) { - $exit_code = build_all_components($Build_OsVer, $Build_Debug, $Build_Temp, $Build_Force); - goto DONE; -} else { - show_menu; -} - -foreach my $INSTALL_CHOICE ( @INSTALL_CHOICES ) -{ - if ($allow_install && $INSTALL_CHOICE == 1) - { - NormalPrint ("Alert: This may install/uninstall only some components of the OFA OPA stack.\n"); - NormalPrint (" Due to rpm dependency, this operation may lead to rpm database\n"); - NormalPrint (" inconsistency in your system. Alternatively, you can uninstall your\n"); - NormalPrint (" OFA OPA stack and then install individual rpms one by one. \n"); - my $choice = GetChoice("Do you still wish to proceed(y/n)?", "y", ("y", "n")); - if ("$choice" eq "n") { - goto RESTART; - } - select_debug_release("."); - show_install_menu(1); - if (! $Default_Prompt) { - goto RESTART; - } else { - if ($exit_code == 0) { - print "Done Installing OPA Software.\n" - } else { - print "Failed to install all OPA software.\n" - } - } - } - elsif ($INSTALL_CHOICE == 1) { - show_installed(1); - goto RESTART; - } - elsif ($INSTALL_CHOICE == 4) - { - show_uninstall_menu(1); - if (! $Default_Prompt ) { - goto RESTART; - } else { - if ($exit_code == 0) { - print "Done Uninstalling OPA Software.\n" - } else { - print "Failed to uninstall all OPA Software.\n" - } - } - } - elsif ($INSTALL_CHOICE == 2) - { - Config_ifcfg(1,"$ComponentInfo{'delta_ipoib'}{'Name'}","ib", "$FirstIPoIBInterface",1); - check_network_config; - #Config_IPoIB_cfg; - goto RESTART; - } - elsif ($INSTALL_CHOICE == 3) - { - reconfig_autostart; - if (! $Default_Prompt ) { - goto RESTART; - } else { - print "Done OPA Driver Autostart Configuration.\n" - } - } -} -DONE: -close_log; -exit $exit_code; diff --git a/CommonInstall/main_ofed.pl b/CommonInstall/main_ofed.pl deleted file mode 100755 index 151503e5..00000000 --- a/CommonInstall/main_ofed.pl +++ /dev/null @@ -1,1047 +0,0 @@ -#!/usr/bin/perl -# BEGIN_ICS_COPYRIGHT8 **************************************** -# -# Copyright (c) 2015, Intel Corporation -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# END_ICS_COPYRIGHT8 **************************************** - -# [ICS VERSION STRING: unknown] -use strict; -#use Term::ANSIColor; -#use Term::ANSIColor qw(:constants); -#use File::Basename; -#use Math::BigInt; - -# =========================================================================== -# Main menus, option handling and version handling for FF for OFED install -# - -$MainInstall="ofed"; - -@supported_kernels = ( $CUR_OS_VER ); # TBD how do we verify OS -my $Build_OsVer=$CUR_OS_VER; -my $Build_Debug=0; # should we provide more info for debug -my $Build_Temp=""; # temp area to use for build -my $Default_Build = 0; # -B option used to select build -my $Build_Force = 0;# rebuild option used to force full rebuild - -$FirstIPoIBInterface=0; # first device is ib0 - - # Names of supported install components - # must be listed in depdency order such that prereqs appear 1st -# TBD ofed_vnic -@Components = ( "opa_stack", "intel_hfi", "ofed_mlx4", "mpi_selector", - "ib_wfr_lite", - "opa_stack_dev", - "ofed_ipoib", "ofed_ib_bonding", - "mvapich2", "openmpi", "gasnet", "openshmem", - "ofed_mpisrc", "ofed_udapl", "ofed_rds", - "ofed_srp", "ofed_srpt", "ofed_iser", "ofed_iwarp", - "opensm", "ofed_nfsrdma", "ofed_debug", "ibacm",); -# ofed_nfsrdma dropped in OFED 1.5.3rc2 -# ofed_debug must be last - -@SubComponents = ( ); - - # an additional "special" component which is always installed when - # we install/upgrade anything and which is only uninstalled when everything - # else has been uninstalled. Typically this will be the opaconfig - # file and related files absolutely required by it (such as wrapper_version) -$WrapperComponent = "opa_config_ofed"; - -# This provides more detailed information about each Component in @Components -# since hashes are not retained in the order specified, we still need -# @Components and @SubComponents to control install and menu order -# Fields are as follows: -# Name => full name of component/subcomponent for prompts -# DefaultInstall => default installation (State_DoNotInstall or State_Install) -# used only when available and ! installed -# SrcDir => directory name within install media for component -# DriverSubdir => directory within /lib/modules/$CUR_OS_VERSION/ to -# install driver to. Set to "" if no drivers in component -# set to "." if no subdir -# PreReq => other components which are prereqs of a given -# component/subcomponent -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# CoReq => other components which are coreqs of a given component -# Note that CoReqs can also be listed as prereqs to provide -# install verification as each component is installed, -# however prereqs should only refer to items earlier in the list -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# Hidden => component should not be shown in menus/prompts -# used for hidden PreReq. Hidden components can't HasStart -# nor HasFirmware -# Disabled => components/subcomponents which are disabled from installation -# HasStart => components/subcomponents which have autostart capability -# DefaultStart => should autostart default to Enable (1) or Disable (0) -# Not needed/ignored unless HasStart=1 -# StartPreReq => other components/subcomponents which must be autostarted -# before autostarting this component/subcomponent -# Not needed/ignored unless HasStart=1 -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# StartComponents => components/subcomponents with start for this component -# if a component has a start script -# list the component as a subcomponent of itself -# HasFirmware => components which need HCA firmware update after installed -# -# Note both Components and SubComponents are included in the list below. -# Components require all fields be supplied -# SubComponents only require the following fields: -# Name, PreReq (should reference only components), HasStart, StartPreReq, -# DefaultStart -%ComponentInfo = ( - # our special WrapperComponent, limited use - "opa_config_ofed" => { Name => "opa_config_ofed", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => "", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opa_stack" => { Name => "OFA OPA Stack", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => "", CoReq => "", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => "", - StartComponents => [ "opa_stack" ], - }, - "intel_hfi" => { Name => "Intel HFI Driver", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "intel_hfi" ], - }, - "ofed_mlx4" => { Name => "OFED mlx4 Driver", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_mlx4" ], - }, - "ib_wfr_lite" => { Name => "WFR Lite Driver", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ib_wfr_lite" ], - }, - "mpi_selector" => { Name => "MPI selector", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 1, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opa_stack_dev" => { Name => "OFA OPA Development", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "ofed_vnic" => { Name => "OFED Virtual NIC", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_vnic" ], - }, - "ofed_ipoib" => { Name => "OFA IP over IB", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_ipoib" ], - }, - "ofed_ib_bonding" => { Name => "OFA IB Bonding", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ofed_ipoib ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "ofed_rds" => { Name => "OFED RDS", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ofed_ipoib ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_rds" ], - }, - "ofed_udapl" => { Name => "OFED uDAPL", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ofed_ipoib ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mvapich2" => { Name => "MVAPICH2 (verbs,gcc)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi" => { Name => "OpenMPI (verbs,gcc)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "gasnet" => { Name => "Gasnet (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openshmem" => { Name => "OpenSHMEM (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi opa_stack gasnet", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "ofed_mpisrc" =>{ Name => "MPI Source", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack opa_stack_dev mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "ofed_srp" => { Name => "OFED SRP", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_srp" ], - }, - "ofed_srpt" => { Name => "OFED SRP Target", - DefaultInstall => $State_DoNotAutoInstall, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_srpt" ], - }, - "ofed_iser" => { Name => "OFED iSER", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_iser" ], - }, - "ofed_iwarp" => { Name => "OFED iWARP", - DefaultInstall => $State_DoNotAutoInstall, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_iwarp" ], - }, - "opensm" => { Name => "OFED Open SM", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ "opensm" ], - }, - "ofed_nfsrdma" =>{ Name => "OFED NFS RDMA", - DefaultInstall => $State_DoNotAutoInstall, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ofed_ipoib ", CoReq => "", - # for now, skip startup option for nfs and nfslock - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ ], - }, - "ofed_debug" => { Name => "OFA Debug Info", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "ibacm" => { Name => "OFA IBACM", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ "ibacm" ], - }, - ); - # translate from startup script name to component/subcomponent name -%StartupComponent = ( - "openibd" => "opa_stack", - "opensmd" => "opensm", - "ipoib" => "ipoib", - "udapl" => "udapl", - "rds" => "rds" - ); - # has component been loaded since last configured autostart -%ComponentWasInstalled = ( - "opa_stack" => 0, - "intel_hfi" => 0, - "ofed_mlx4" => 0, - "mpi_selector" => 0, - "opa_stack_dev" => 0, - "ofed_vnic" => 0, - "ofed_ipoib" => 0, - "ofed_ib_bonding" => 0, - "ofed_rds" => 0, - "ofed_udapl" => 0, - "mvapich2" => 0, - "openmpi" => 0, - "gasnet" => 0, - "openshmem" => 0, - "ofed_mpisrc" => 0, - "ofed_srp" => 0, - "ofed_srpt" => 0, - "ofed_iser" => 0, - "ofed_iwarp" => 0, - "opensm" => 0, - "ofed_nfsrdma" => 0, - "ofed_debug" => 0, - "ibacm" => 0, - ); - -# ========================================================================== -# opa_config_ofed installation -# This is a special WrapperComponent which only needs: -# available, install and uninstall -# it cannot have startup scripts, dependencies, prereqs, etc - -sub available_opa_config_ofed -{ - my $srcdir=$ComponentInfo{'opa_config_ofed'}{'SrcDir'}; - return ( -e "$srcdir/INSTALL" ); -} - -sub install_opa_config_ofed -{ - my $install_list = $_[0]; # total that will be installed when done - my $installing_list = $_[1]; # what items are being installed/reinstalled - - my $srcdir=$ComponentInfo{'opa_config_ofed'}{'SrcDir'}; - NormalPrint("Installing $ComponentInfo{'opa_config_ofed'}{'Name'}...\n"); - - check_config_dirs(); - copy_systool_file("$srcdir/INSTALL", "/sbin/opa_config_ofed"); - # no need for a version file, ofed will have its own - - # if IFS OFED is not installed, create opa_config too - if ( ! -e "$BASE_DIR/version_wrapper" ) { - copy_systool_file("$srcdir/INSTALL", "/sbin/opaconfig"); - } - - $ComponentWasInstalled{'opa_config_ofed'}=1; -} - -sub uninstall_opa_config_ofed -{ - my $install_list = $_[0]; # total that will be left installed when done - my $uninstalling_list = $_[1]; # what items are being uninstalled - - NormalPrint("Uninstalling $ComponentInfo{'opa_config_ofed'}{'Name'}...\n"); - system("rm -rf $ROOT/sbin/opa_config_ofed"); - # if IFS OFED is not installed, remove opaconfig too - if ( ! -e "$BASE_DIR/version_wrapper" ) { - system("rm -rf $ROOT/sbin/opaconfig"); - } - $ComponentWasInstalled{'opa_config_ofed'}=0; -} - -my $allow_install; -if ( my_basename($0) ne "INSTALL" ) -{ - if ( my_basename($0) eq "ics_ib" ) - { - printf("Warning: ics_ib is depricated, use opaconfig\n"); - HitKeyCont; - } - $allow_install=0; -} else { - $allow_install=1; -} - -# -# Check if all basic requirements are ok -# -sub verify_os_ver -{ - determine_os_version; - #my $supported_kernel; - # - #if (!$allow_install) - #{ - # my $catkernels = `cat $ROOT$BASE_DIR/supported_kernels`; - # @supported_kernels = split( / +/, $catkernels); - #} else { - # system("echo -n @supported_kernels > ./config/supported_kernels"); - #} - # - #foreach my $supported_kernel_path ( @supported_kernels ) - #{ - # $supported_kernel = my_basename($supported_kernel_path); - # - # $module_dirs[++$#module_dirs] = "/lib/modules/$supported_kernel"; - #} - # make sure current OS version included so remove_driver works - $module_dirs[++$#module_dirs] = "/lib/modules/$CUR_OS_VER"; -} - -sub Usage -{ - if ( $allow_install ) { - #printf STDERR "Usage: $0 [-r root] [-v|-vv] -R osver -B osver [-d][-t tempdir] [--user_configure_options 'options'] [--kernel_configure_options 'options'] [--prefix dir] [--without-depcheck] [--rebuild] [--force] [--answer keyword=value] [--debug]\n"; - #printf STDERR " or\n"; - #printf STDERR "Usage: $0 [-r root] [-v|-vv] [-a|-n|-U|-u|-s|-i comp|-e comp] [-E comp] [-D comp] [-l] [--user_configure_options 'options'] [--kernel_configure_options 'options'] [--prefix dir] [--without-depcheck] [--rebuild] [--force] [--answer keyword=value] [--debug]\n"; - #printf STDERR "Usage: $0 [-r root] [-v|-vv] [-a|-n|-U|-u|-s|-i comp|-e comp|-E comp|-D comp] [--user_configure_options 'options'] [--kernel_configure_options 'options'] [--prefix dir] [--without-depcheck] [--rebuild] [--force] [--answer=value]\n"; - printf STDERR "Usage: $0 [-r root] [-v|-vv] [-a|-n|-U|-u|-s|-i comp|-e comp|-E comp|-D comp] [--user_configure_options 'options'] [--kernel_configure_options 'options'] [--prefix dir] [--without-depcheck] [--rebuild] [--force] [--answer=value]\n"; - } else { - printf STDERR "Usage: $0 [-r root] [-v|-vv] [-u|-s|-e comp] [-E comp] [-D comp] [--answer=value]\n"; - printf STDERR " [--user_queries|--no_user_queries]\n"; - } - printf STDERR " or\n"; - printf STDERR "Usage: $0 -C\n"; - printf STDERR " or\n"; - printf STDERR "Usage: $0 -V\n"; - if ( $allow_install ) { - printf STDERR " -a - install all ULPs and drivers with default options\n"; - printf STDERR " -n - install all ULPs and drivers with default options\n"; - printf STDERR " but with no change to autostart options\n"; - printf STDERR " -U - upgrade/re-install all presently installed ULPs and drivers with\n"; - printf STDERR " default options and no change to autostart options\n"; - printf STDERR " -i comp - install the given component with default options\n"; - printf STDERR " can appear more than once on command line\n"; - #printf STDERR " -l - skip creating/removing symlinks to /usr/local from /usr/lib/opa\n"; - printf STDERR " --user_configure_options 'options' - specify additional OFED build\n"; - printf STDERR " options for user space srpms. Causes rebuild of all user srpms\n"; - printf STDERR " --kernel_configure_options 'options' - specify additional OFED build\n"; - printf STDERR " options for driver srpms. Causes rebuild of all driver srpms\n"; - printf STDERR " --prefix dir - specify alternate directory prefix for install\n"; - printf STDERR " default is /usr. Causes rebuild of needed srpms\n"; - printf STDERR " --without-depcheck - disable check of OS dependencies\n"; - printf STDERR " --rebuild - force OFED rebuild\n"; - printf STDERR " --force - force install even if distos don't match\n"; - printf STDERR " Use of this option can result in undefined behaviors\n"; - # --debug, -B, -t and -d options are purposely not documented - #printf STDERR " --debug - build a debug version of modules\n"; - #printf STDERR " -B osver - run build for all components targetting kernel osver\n"; - #printf STDERR " -t - temp area for use by builds, only valid with -B\n"; - #printf STDERR " -d - enable build debugging assists, only valid with -B\n"; - #printf STDERR " -R osver - force install for kernel osver rather than running kernel.\n"; - } - printf STDERR " -u - uninstall all ULPs and drivers with default options\n"; - printf STDERR " -s - enable autostart for all installed drivers\n"; - printf STDERR " -r - specify alternate root directory, default is /\n"; - printf STDERR " -e comp - uninstall the given component with default options\n"; - printf STDERR " can appear more than once on command line\n"; - printf STDERR " -E comp - enable autostart of given component\n"; - printf STDERR " can appear with -D or more than once on command line\n"; - printf STDERR " -D comp - disable autostart of given component\n"; - printf STDERR " can appear with -E or more than once on command line\n"; - printf STDERR " -v - verbose logging\n"; - printf STDERR " -vv - very verbose debug logging\n"; - printf STDERR " -C - output list of supported components\n"; - printf STDERR " -V - output Version\n"; - - printf STDERR " --user_queries - permit non-root users to query the fabric. (default)\n"; - printf STDERR " --no_user_queries - non root users cannot query the fabric.\n"; - showAnswerHelp(); - - printf STDERR " default options retain existing configuration files\n"; - printf STDERR " supported component names:\n"; - printf STDERR " "; - foreach my $comp ( @Components ) - { - printf STDERR " $comp"; - } - printf STDERR "\n"; - if (scalar(@SubComponents) > 0) { - printf STDERR " additional component names allowed for -E and -D options:\n"; - printf STDERR " "; - foreach my $comp ( @SubComponents ) - { - printf STDERR " $comp"; - } - printf STDERR "\n"; - } - exit (2); -} - -# translate an ibaccess component name into the corresponding list of ofed comps -# if the given name is invalid or has no corresponding OFED component -# returns an empty list -sub translate_comp -{ - my($arg)=$_[0]; - if ("$arg" eq "ibdev") { return ( "opa_stack_dev" ); - } elsif ("$arg" eq "opa") { return ( "oftools", - "mvapich2_gcc_hfi", "openmpi_gcc_hfi", "mvapich2_intel_hfi", - "openmpi_intel_hfi", "mvapich2_pgi_hfi", "openmpi_pgi_hfi" ); - } elsif ("$arg" eq "ifibre") { return ( "ofed_srp" ); - } elsif ("$arg" eq "ipoib") { return ( "ofed_ipoib", "ib_bonding_marker" ); - } elsif ("$arg" eq "mpi") { return ( "mvapich2", "openmpi", - "mvapich2_gcc_hfi", "openmpi_gcc_hfi", "mvapich2_intel_hfi", - "openmpi_intel_hfi", "mvapich2_pgi_hfi", "openmpi_pgi_hfi" ); - } elsif ("$arg" eq "mpisrc") { return ( "ofed_mpisrc" ); - } elsif ("$arg" eq "udapl") { return ( "ofed_udapl" ); - } elsif ("$arg" eq "rds") { return ( "ofed_rds" ); - # no ibaccess argument equivalent for: ofed_srpt, ofed_iser, - # openmpi, ofed_iwarp, opensm, ofed_nfsrdma, ofed_debug - # - } else { - return (); # invalid name - } -} - -sub process_args -{ - my $arg; - my $last_arg; - my $setroot = 0; - my $install_opt = 0; - my $setcomp = 0; - my $setenabled = 0; - my $setdisabled = 0; - my $setosver = 0; - my $setbuildtemp = 0; - my $comp = 0; - my $osver = 0; - my $setuseroptions = 0; - my $setcurosver = 0; - my $setkerneloptions = 0; - my $setprefix = 0; - my $setanswer = 0; - my $patch_ofed=0; - - if (scalar @ARGV >= 1) { - foreach $arg (@ARGV) { - if ( $setroot ) { - $ROOT="$arg"; - if (substr($ROOT,0,1) ne "/") { - printf STDERR "Invalid -r root (must be absolute path): '$ROOT'\n"; - Usage; - } - if (! -d $ROOT) { - printf STDERR "Invalid -r root (directory not found): '$ROOT'\n"; - Usage; - } - $setroot=0; - } elsif ( $setanswer ) { - my @pair = split /=/,$arg; - if ( scalar(@pair) != 2 ) { - printf STDERR "Invalid --answer keyword=value: '$arg'\n"; - Usage; - } - set_answer($pair[0], $pair[1]); - $setanswer=0; - } elsif ( $setcomp ) { - foreach $comp ( @Components ) - { - if ( "$arg" eq "$comp" ) - { - $Default_Components{$arg} = 1; - $setcomp=0; - } - } - if ( $setcomp ) - { - my @comps = translate_comp($arg); - # if empty list returned, we will not clear setcomp and - # will get error below - foreach $comp ( @comps ) - { - $Default_Components{$comp} = 1; - $setcomp=0; - } - } - if ( $setcomp ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( $setenabled ) { - foreach $comp ( @Components, @SubComponents ) - { - if ( "$arg" eq "$comp" ) - { - $Default_EnabledComponents{$arg} = 1; - $setenabled=0; - } - } - if ( $setenabled ) - { - my @comps = translate_comp($arg); - # if empty list returned, we will not clear setcomp and - # will get error below - foreach $comp ( @comps ) - { - $Default_EnabledComponents{$comp} = 1; - $setenabled=0; - } - } - if ( $setenabled ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( $setdisabled ) { - foreach $comp ( @Components, @SubComponents ) - { - if ( "$arg" eq "$comp" ) - { - $Default_DisabledComponents{$arg} = 1; - $setdisabled=0; - } - } - if ( $setdisabled ) - { - my @comps = translate_comp($arg); - # if empty list returned, we will not clear setcomp and - # will get error below - foreach $comp ( @comps ) - { - $Default_DisabledComponents{$comp} = 1; - $setdisabled=0; - } - } - if ( $setdisabled ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( $setosver ) { - $Build_OsVer="$arg"; - $setosver=0; - } elsif ( $setbuildtemp ) { - $Build_Temp="$arg"; - $setbuildtemp=0; - } elsif ( $setuseroptions ) { - $OFED_user_configure_options="$arg"; - $setuseroptions=0; - } elsif ( $setkerneloptions ) { - $OFED_kernel_configure_options="$arg"; - $setkerneloptions=0; - } elsif ( $setprefix ) { - $OFED_prefix="$arg"; - $setprefix=0; - } elsif ( $setcurosver ) { - $CUR_OS_VER="$arg"; - @supported_kernels = ( $CUR_OS_VER ); - $setcurosver=0; - } elsif ( "$arg" eq "-r" ) { - $setroot=1; - } elsif ( "$arg" eq "-v" ) { - $LogLevel=1; - } elsif ( "$arg" eq "-vv" ) { - $LogLevel=2; - } elsif ( "$arg" eq "-i" ) { - $Default_CompInstall=1; - $Default_Prompt=1; - $setcomp=1; - if ($install_opt || $Default_CompUninstall || $Default_Build) { - # can't mix -i with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-e" ) { - $Default_CompUninstall=1; - $Default_Prompt=1; - $setcomp=1; - if ($install_opt || $Default_CompInstall || $Default_Build) { - # can't mix -e with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-E" ) { - $Default_Autostart=1; - $Default_EnableAutostart=1; - $Default_Prompt=1; - $setenabled=1; - if ($Default_Build) { - # can't mix -E with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-D" ) { - $Default_Autostart=1; - $Default_DisableAutostart=1; - $Default_Prompt=1; - $setdisabled=1; - if ($Default_Build) { - # can't mix -D with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "--user_configure_options" ) { - $setuseroptions=1; - } elsif ( "$arg" eq "--kernel_configure_options" ) { - $setkerneloptions=1; - } elsif ( "$arg" eq "--prefix" ) { - $setprefix=1; - } elsif ( "$arg" eq "--answer" ) { - $setanswer=1; - } elsif ( "$arg" eq "--without-depcheck" ) { - $rpm_check_dependencies=0; - } elsif ( "$arg" eq "--force" ) { - $Force_Install=1; - } elsif ( "$arg" eq "-C" ) { - ShowComponents; - exit(0); - } elsif ( "$arg" eq "-V" ) { - printf "$VERSION\n"; - exit(0); - } elsif ( "$arg" eq "-R" ) { - $setcurosver=1; - } elsif ( "$arg" eq "-B" ) { - # undocumented option to do a build for specific OS - $Default_Build=1; - $Default_Prompt=1; - $setosver=1; - if ($install_opt || $Default_CompInstall || $Default_CompUninstall || $Default_Autostart) { - # can't mix -B with install - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-d" ) { - # undocumented option to aid debug of build - $Build_Debug=1; - if ($install_opt || $Default_CompInstall || $Default_CompUninstall || $Default_Autostart) { - # can't mix -d with install - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-t" ) { - # undocumented option to aid debug of build - $setbuildtemp=1; - if ($install_opt || $Default_CompInstall || $Default_CompUninstall || $Default_Autostart) { - # can't mix -t with install - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "--rebuild" ) { - # force rebuild - $Build_Force=1; - $OFED_force_rebuild=1; - } elsif ( "$arg" eq "--debug" ) { - $OFED_debug=1; - } elsif ( "$arg" eq "--user_queries" ) { - $Default_UserQueries=1; - } elsif ( "$arg" eq "--no_user_queries" ) { - $Default_UserQueries=-1; - } elsif ( "$arg" eq "--patch_ofed" ) { - $patch_ofed=1; - } else { - # Install options - if ( "$arg" eq "-a" ) { - $Default_Install=1; - } elsif ( "$arg" eq "-u" ) { - $Default_Uninstall=1; - } elsif ( "$arg" eq "-s" ) { - $Default_Autostart=1; - } elsif ( "$arg" eq "-n" ) { - $Default_Install=1; - $Default_SameAutostart=1; - } elsif ( "$arg" eq "-U" ) { - $Default_Upgrade=1; - $Default_SameAutostart=1; - } else { - printf STDERR "Invalid option: $arg\n"; - Usage; - } - if ($install_opt || $Default_CompInstall - || $Default_CompUninstall) { - # only one of the above install selections - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - $install_opt=1; - $Default_Prompt=1; - } - $last_arg=$arg; - } - } - if ( $setroot || $setcomp || $setenabled || $setdisabled || $setosver || $setbuildtemp || $setuseroptions || $setkerneloptions || $setprefix || $setanswer) { - printf STDERR "Missing argument for option: $last_arg\n"; - Usage; - } - if ( ($Default_Install || $Default_CompInstall || $Default_Upgrade - || $Force_Install) - && ! $allow_install) { - printf STDERR "Installation options not permitted in this mode\n"; - Usage; - } - if ( ($Default_Build || $OFED_force_rebuild || $OFED_debug - || ($OFED_user_configure_options ne '') - || ($OFED_kernel_configure_options ne '') - || ($OFED_prefix ne '/usr')) - && ! $allow_install) { - printf STDERR "Build options not permitted in this mode\n"; - Usage; - } - if ( $patch_ofed) { - NormalPrint("Patching OFED...\n"); - LogPrint("Executing: cd $ComponentInfo{'opa_stack'}{'SrcDir'}; ./patch_ofed3\n"); - system("cd $ComponentInfo{'opa_stack'}{'SrcDir'}; ./patch_ofed3"); - HitKeyCont; - } -} - -my @INSTALL_CHOICES= (); -sub show_menu -{ - my $inp; - my $max_inp; - - @INSTALL_CHOICES= (); - if ( $Default_Install ) { - NormalPrint ("Installing All OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ( $Default_CompInstall ) { - NormalPrint ("Installing Selected OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ( $Default_Upgrade ) { - NormalPrint ("Upgrading/Re-Installing OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ( $Default_Uninstall ) { - NormalPrint ("Uninstalling All OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 4); - } - if ($Default_CompUninstall ) { - NormalPrint ("Uninstalling Selected OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 4); - } - if ($Default_Autostart) { - NormalPrint ("Configuring autostart for Selected installed OPA Drivers\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 3); - } - if (scalar(@INSTALL_CHOICES) > 0) { - return; - } -START: - system "clear"; - printf ("$BRAND OPA $VERSION Software\n\n"); - if ($allow_install) { - printf (" 1) Install/Uninstall Software\n"); - } else { - printf (" 1) Show Installed Software\n"); - } - printf (" 2) Reconfigure $ComponentInfo{'ofed_ipoib'}{'Name'}\n"); - printf (" 3) Reconfigure Driver Autostart \n"); - $max_inp=3; - if (!$allow_install) - { - printf (" 4) Uninstall Software\n"); - $max_inp=4; - } - printf ("\n X) Exit\n"); - - - $inp = getch(); - - if ($inp =~ /[qQ]/ || $inp =~ /[Xx]/ ) { - @INSTALL_CHOICES = ( 99999 ); # indicates exit, none selected - return; - } - if (ord($inp) == $KEY_ENTER) { - goto START; - } - - if ($inp =~ /[0123456789abcdefABCDEF]/) - { - $inp = hex($inp); - } - - if ($inp < 1 || $inp > $max_inp) - { -# printf ("Invalid choice...Try again\n"); - goto START; - } - @INSTALL_CHOICES = ( $inp ); -} - -process_args; -check_root_user; -if ( ! $Default_Build ) { - open_log(""); -} else { - open_log("./build.log"); -} - -if ( ! $Default_Build ) { - verify_os_ver; - verify_modtools; - #if ($allow_install) { - # verify_distrib_files; - #} -} else { - determine_os_version; -} -# post process ib_bonding_marker selection via command line args so -# can check Available for ib-bonding -if ( $Default_Components{'ib_bonding_marker'} ) { - if ( comp_is_available('ofed_ib_bonding') ) { - $Default_Components{'ofed_ib_bonding'} = 1; - } -} -if ( $Default_EnabledComponents{'ib_bonding_marker'} ) { - if ( comp_is_available('ofed_ib_bonding') ) { - $Default_EnabledComponents{'ofed_ib_bonding'} = 1; - } -} -if ( $Default_DisabledComponents{'ib_bonding_marker'} ) { - if ( comp_is_available('ofed_ib_bonding') ) { - $Default_DisabledComponents{'ofed_ib_bonding'} = 1; - } -} - -set_libdir; -init_ofed_rpm_info($CUR_OS_VER); - -RESTART: -if ($Default_Build) { - $exit_code = build_all_components($Build_OsVer, $Build_Debug, $Build_Temp, $Build_Force); - goto DONE; -} else { - show_menu; -} - -foreach my $INSTALL_CHOICE ( @INSTALL_CHOICES ) -{ - if ($allow_install && $INSTALL_CHOICE == 1) - { - select_debug_release("."); - show_install_menu(1); - if (! $Default_Prompt) { - goto RESTART; - } else { - if ($exit_code == 0) { - print "Done Installing OPA Software.\n" - } else { - print "Failed to install all OPA software.\n" - } - } - } - elsif ($INSTALL_CHOICE == 1) { - show_installed(1); - goto RESTART; - } - elsif ($INSTALL_CHOICE == 4) - { - show_uninstall_menu(1); - if (! $Default_Prompt ) { - goto RESTART; - } else { - if ($exit_code == 0) { - print "Done Uninstalling OPA Software.\n" - } else { - print "Failed to uninstall all OPA Software.\n" - } - } - } - elsif ($INSTALL_CHOICE == 2) - { - Config_ifcfg(1,"$ComponentInfo{'ofed_ipoib'}{'Name'}","ib", "$FirstIPoIBInterface",1); - check_network_config; - #Config_IPoIB_cfg; - goto RESTART; - } - elsif ($INSTALL_CHOICE == 3) - { - reconfig_autostart; - if (! $Default_Prompt ) { - goto RESTART; - } else { - print "Done OPA Driver Autostart Configuration.\n" - } - } -} -DONE: -close_log; -exit $exit_code; diff --git a/CommonInstall/main_ofedbuild.pl b/CommonInstall/main_ofedbuild.pl deleted file mode 100644 index 5318445e..00000000 --- a/CommonInstall/main_ofedbuild.pl +++ /dev/null @@ -1,423 +0,0 @@ -#!/usr/bin/perl -# BEGIN_ICS_COPYRIGHT8 **************************************** -# -# Copyright (c) 2015, Intel Corporation -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# END_ICS_COPYRIGHT8 **************************************** - -# [ICS VERSION STRING: unknown] -use strict; -#use Term::ANSIColor; -#use Term::ANSIColor qw(:constants); -#use File::Basename; -#use Math::BigInt; - -# =========================================================================== -# Main menus, option handling and version handling for FF for OFED install -# - -$MainInstall="ofedbuild"; - -my $Build_OsVer=$CUR_OS_VER; -my $Build_Debug=0; # should we provide more info for debug -my $Build_Temp=""; # temp area to use for build -my $Build_Force = 0;# rebuild option used to force full rebuild - -my $FirstIPoIBInterface=0; # first device is ib0 - - # Names of supported install components - # must be listed in depdency order such that prereqs appear 1st -@Components = ( "opa_stack", "ofed_mlx4", "opa_stack_dev", "ofed_ipoib", - "ofed_ib_bonding", "mpi_selector", - "mvapich2", "openmpi", "ofed_mpisrc", "ofed_udapl", "ofed_rds", - "ofed_srp", "ofed_srpt", "ofed_iser", - "ofed_iwarp", "opensm", "ofed_nfsrdma", "ofed_debug" ); - "opensm", "ofed_nfsrdma", "ofed_debug", ); -# ofed_nfsrdma dropped in OFED 1.5.3rc2 -# ofed_debug must be last - -@SubComponents = ( ); - - # an additional "special" component which is always installed when - # we install/upgrade anything and which is only uninstalled when everything - # else has been uninstalled. Typically this will be the opaconfig - # file and related files absolutely required by it (such as wrapper_version) -$WrapperComponent = ""; - -# This provides more detailed information about each Component in @Components -# since hashes are not retained in the order specified, we still need -# @Components and @SubComponens to control install and menu order -# Fields are as follows: -# Name => full name of component/subcomponent for prompts -# DefaultInstall => default installation (State_DoNotInstall or State_Install) -# used only when available and ! installed -# SrcDir => directory name within install media for component -# DriverSubdir => directory within /lib/modules/$CUR_OS_VERSION/ to -# install driver to. Set to "" if no drivers in component -# set to "." if no subdir -# PreReq => other components which are prereqs of a given -# component/subcomponent -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# CoReq => other components which are coreqs of a given component -# Note that CoReqs can also be listed as prereqs to provide -# install verification as each component is installed, -# however prereqs should only refer to items earlier in the list -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# Hidden => component should not be shown in menus/prompts -# used for hidden PreReq. Hidden components can't HasStart -# nor HasFirmware -# Disabled => components/subcomponents which are disabled from installation -# HasStart => components/subcomponents which have autostart capability -# DefaultStart => should autostart default to Enable (1) or Disable (0) -# Not needed/ignored unless HasStart=1 -# StartPreReq => other components/subcomponents which must be autostarted -# before autostarting this component/subcomponent -# Not needed/ignored unless HasStart=1 -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# StartComponents => components/subcomponents with start for this component -# if a component has a start script -# list the component as a subcomponent of itself -# HasFirmware => components which need HCA firmware update after installed -# -# Note both Components and SubComponents are included in the list below. -# Components require all fields be supplied -# SubComponents only require the following fields: -# Name, PreReq (should reference only components), HasStart, StartPreReq, -# DefaultStart -%ComponentInfo = ( - "opa_stack" => { Name => "OFA OPA Stack", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => "", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => "", - StartComponents => [ "opa_stack" ], - }, - "ofed_mlx4" => { Name => "OFA mlx4 Driver", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_mlx4" ], - }, - "opa_stack_dev" => { Name => "OFA OPA Development", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "ofed_ipoib" => { Name => "OFA IP over IB", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_ipoib" ], - }, - "ofed_ib_bonding" => { Name => "OFA IB Bonding", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ofed_ipoib ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "ofed_rds" => { Name => "OFA RDS", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ofed_ipoib ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_rds" ], - }, - "ofed_udapl" => { Name => "OFA uDAPL", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ofed_ipoib ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mpi_selector" => { Name => "MPI selector", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 1, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mvapich2" => { Name => "MVAPICH2 for gcc", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi" => { Name => "OpenMPI for gcc", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "ofed_mpisrc" =>{ Name => "MPI Source", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack opa_stack_dev mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "ofed_srp" => { Name => "OFA SRP", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_srp" ], - }, - "ofed_srpt" => { Name => "OFA SRP Target", - DefaultInstall => $State_DoNotAutoInstall, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_srpt" ], - }, - "ofed_iser" => { Name => "OFA iSER", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_iser" ], - }, - "ofed_iwarp" => { Name => "OFA iWARP", - DefaultInstall => $State_DoNotAutoInstall, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_iwarp" ], - }, - "opensm" => { Name => "OFA Open SM", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ "opensm" ], - }, - "ofed_nfsrdma" =>{ Name => "OFA NFS RDMA", - DefaultInstall => $State_DoNotAutoInstall, - SrcDir => ".", DriverSubdir => "updates", - PreReq => " opa_stack ofed_ipoib ", CoReq => "", - # for now, skip startup option for nfs and nfslock - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "ofed_debug" => { Name => "OFA Debug Info", - DefaultInstall => $State_DoNotInstall, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - ); - # translate from startup script name to component/subcomponent name -%StartupComponent = ( - "openibd" => "opa_stack", - "opensmd" => "opensm", - "ipoib" => "ipoib", - "udapl" => "udapl", - "ics_sdp" => "sdp", - "rds" => "rds" - ); - # has component been loaded since last configured autostart -%ComponentWasInstalled = ( - "opa_stack" => 0, - "ofed_mlx4" => 0, - "opa_stack_dev" => 0, - "ofed_ipoib" => 0, - "ofed_ib_bonding" => 0, - "ofed_rds" => 0, - "ofed_udapl" => 0, - "mpi_selector" => 0, - "mvapich2" => 0, - "openmpi" => 0, - "ofed_mpisrc" => 0, - "ofed_srp" => 0, - "ofed_srpt" => 0, - "ofed_iser" => 0, - "ofed_iwarp" => 0, - "opensm" => 0, - "ofed_nfsrdma" => 0, - "ofed_debug" => 0, - ); - -sub Usage -{ - #printf STDERR "Usage: $0 [-i] [-v|-vv] [-V osver] [-t tempdir] [-d] [--user_configure_options 'options'] [--kernel_configure_options 'options'] [--prefix dir] [--without-depcheck] [--rebuild] [--answer keyword=value] [--debug]\n"; - printf STDERR "Usage: $0 [-i] [-v|-vv] [-V osver] [-t tempdir] [-d] [--user_configure_options 'options'] [--kernel_configure_options 'options'] [--prefix dir] [--without-depcheck] [--rebuild] [--answer keyword=value] [--debug]\n"; - printf STDERR " -i - interactive prompts, default is to build without prompts\n"; - printf STDERR " -v - verbose logging\n"; - printf STDERR " -vv - very verbose debug logging\n"; - printf STDERR " -V osver - kernel version to build for, default is $CUR_OS_VER\n"; - printf STDERR " -t - temp area for use by builds, only valid with -B\n"; - printf STDERR " -d - enable build debugging assists, only valid with -B\n"; - printf STDERR " --user_configure_options 'options' - specify additional OFA build\n"; - printf STDERR " options for user space srpms. Causes rebuild of all user srpms\n"; - printf STDERR " --kernel_configure_options 'options' - specify additional OFA build\n"; - printf STDERR " options for driver srpms. Causes rebuild of all driver srpms\n"; - printf STDERR " --prefix dir - specify alternate directory prefix for install\n"; - printf STDERR " default is /usr. Causes rebuild of needed srpms\n"; - printf STDERR " --without-depcheck - disable check of OS dependencies\n"; - printf STDERR " --rebuild - force full rebuild\n"; - printf STDERR " --debug - build a debug version of modules\n"; - showAnswerHelp(); - exit (2); -} - -$Default_Prompt=1; - -sub process_args -{ - my $arg; - my $last_arg; - my $setosver = 0; - my $setbuildtemp = 0; - my $setuseroptions = 0; - my $setkerneloptions = 0; - my $setprefix = 0; - my $setanswer = 0; - my $osver = 0; - - if (scalar @ARGV >= 1) { - foreach $arg (@ARGV) { - if ( $setosver ) { - $Build_OsVer="$arg"; - $setosver=0; - } elsif ( $setbuildtemp ) { - $Build_Temp="$arg"; - $setbuildtemp=0; - } elsif ( $setuseroptions ) { - $OFED_user_configure_options="$arg"; - $setuseroptions=0; - } elsif ( $setkerneloptions ) { - $OFED_kernel_configure_options="$arg"; - $setkerneloptions=0; - } elsif ( $setprefix ) { - $OFED_prefix="$arg"; - $setprefix=0; - } elsif ( $setanswer ) { - my @pair = split /=/,$arg; - if ( scalar(@pair) != 2 ) { - printf STDERR "Invalid --answer keyword=value: '$arg'\n"; - Usage; - } - set_answer($pair[0], $pair[1]); - $setanswer=0; - } elsif ( "$arg" eq "-v" ) { - $LogLevel=1; - } elsif ( "$arg" eq "-vv" ) { - $LogLevel=2; - } elsif ( "$arg" eq "-V" ) { - $setosver=1; - } elsif ( "$arg" eq "-d" ) { - $Build_Debug=1; - } elsif ( "$arg" eq "-t" ) { - $setbuildtemp=1; - } elsif ( "$arg" eq "-i" ) { - $Default_Prompt=0; - } elsif ( "$arg" eq "--user_configure_options" ) { - $setuseroptions=1; - } elsif ( "$arg" eq "--kernel_configure_options" ) { - $setkerneloptions=1; - } elsif ( "$arg" eq "--prefix" ) { - $setprefix=1; - } elsif ( "$arg" eq "--without-depcheck" ) { - $rpm_check_dependencies=0; - } elsif ( "$arg" eq "--rebuild" ) { - $Build_Force=1; - } elsif ( "$arg" eq "--answer" ) { - $setanswer=1; - } elsif ( "$arg" eq "--debug" ) { - $OFED_debug=1; - } else { - printf STDERR "Invalid option: $arg\n"; - Usage; - } - $last_arg=$arg; - } - } - if ( $setosver || $setbuildtemp || $setuseroptions || $setkerneloptions || $setprefix || $setanswer) { - printf STDERR "Missing argument for option: $last_arg\n"; - Usage; - } -} - -process_args; -check_root_user; -open_log("./build.log"); - -determine_os_version; -set_libdir; -init_ofed_rpm_info($CUR_OS_VER); - -$exit_code = build_all_components($Build_OsVer, $Build_Debug, $Build_Temp, $Build_Force); -close_log; -exit $exit_code; diff --git a/CommonInstall/main_omnipath.pl b/CommonInstall/main_omnipath.pl deleted file mode 100755 index bf97ae2c..00000000 --- a/CommonInstall/main_omnipath.pl +++ /dev/null @@ -1,688 +0,0 @@ -#!/usr/bin/perl -# BEGIN_ICS_COPYRIGHT8 **************************************** -# -# Copyright (c) 2015, Intel Corporation -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# END_ICS_COPYRIGHT8 **************************************** - -# [ICS VERSION STRING: unknown] -use strict; -#use Term::ANSIColor; -#use Term::ANSIColor qw(:constants); -#use File::Basename; -#use Math::BigInt; - -# =========================================================================== -# Main menus, option handling and version handling for FF for OFED install -# - -$MainInstall="omnipath"; - -my $Force_Install = 0;# force option used to force install on unsupported distro - - # Names of supported install components - # must be listed in depdency order such that prereqs appear 1st -my @OmniPathMPIComponents = ( "mvapich2_gcc_hfi", "mvapich2_pgi_hfi", - "mvapich2_intel_hfi", - "openmpi_gcc_hfi", "openmpi_pgi_hfi", - "openmpi_intel_hfi", "intel_shmem" ); -# these are now gone, list them so they get uninstalled -my @old_TrueScaleMPIComponents = ( "mvapich_pathscale_qlc", - "mvapich2_pathscale_qlc", "openmpi_pathscale_qlc" ); -@Components = ( "omnipath", @OmniPathMPIComponents, - @old_TrueScaleMPIComponents, ); - -@SubComponents = ( ); - - # an additional "special" component which is always installed when - # we install/upgrade anything and which is only uninstalled when everything - # else has been uninstalled. Typically this will be the opaconfig - # file and related files absolutely required by it (such as wrapper_version) -$WrapperComponent = "opa_config_omnipath"; - -# This provides more detailed information about each Component in @Components -# since hashes are not retained in the order specified, we still need -# @Components and @SubComponents to control install and menu order -# Fields are as follows: -# Name => full name of component/subcomponent for prompts -# DefaultInstall => default installation (State_DoNotInstall or State_Install) -# used only when available and ! installed -# SrcDir => directory name within install media for component -# DriverSubdir => directory within /lib/modules/$CUR_OS_VERSION/ to -# install driver to. Set to "" if no drivers in component -# set to "." if no subdir -# PreReq => other components which are prereqs of a given -# component/subcomponent -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# CoReq => other components which are coreqs of a given component -# Note that CoReqs can also be listed as prereqs to provide -# install verification as each component is installed, -# however prereqs should only refer to items earlier in the list -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# Hidden => component should not be shown in menus/prompts -# used for hidden PreReq. Hidden components can't HasStart -# nor HasFirmware -# Disabled => components/subcomponents which are disabled from installation -# HasStart => components/subcomponents which have autostart capability -# DefaultStart => should autostart default to Enable (1) or Disable (0) -# Not needed/ignored unless HasStart=1 -# StartPreReq => other components/subcomponents which must be autostarted -# before autostarting this component/subcomponent -# Not needed/ignored unless HasStart=1 -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# StartComponents => components/subcomponents with start for this component -# if a component has a start script -# list the component as a subcomponent of itself -# HasFirmware => components which need HCA firmware update after installed -# -# Note both Components and SubComponents are included in the list below. -# Components require all fields be supplied -# SubComponents only require the following fields: -# Name, PreReq (should reference only components), HasStart, StartPreReq, -# DefaultStart -%ComponentInfo = ( - "opa_config_omnipath" => { Name => "opa_config_omnipath", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => "", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "intel_hfi" => { Name => "Omni Path HFI Libs", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => "", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mvapich2_gcc_hfi" => { Name => "MVAPICH2 (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mvapich2_pgi_hfi" => { Name => "MVAPICH2 (hfi,PGI)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mvapich2_intel_hfi" => { Name => "MVAPICH2 (hfi,Intel)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi_gcc_hfi" => { Name => "OpenMPI (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi_pgi_hfi" => { Name => "OpenMPI (hfi,PGI)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi_intel_hfi" => { Name => "OpenMPI (hfi,Intel)", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " intel_fhi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - ); - # translate from startup script name to component/subcomponent name -%StartupComponent = ( - ); - # has component been loaded since last configured autostart -%ComponentWasInstalled = ( - "intel_hfi" => 0, - "mvapich2_gcc_hfi" => 0, - "mvapich2_pgi_hfi" => 0, - "mvapich2_intel_hfi" => 0, - "openmpi_gcc_hfi" => 0, - "openmpi_pgi_hfi" => 0, - "openmpi_intel_hfi" => 0, - ); - -# ========================================================================== -# opa_config_omnipath installation -# This is a special WrapperComponent which only needs: -# available, install and uninstall -# it cannot have startup scripts, dependencies, prereqs, etc - -sub available_opa_config_omnipath -{ - my $srcdir=$ComponentInfo{'opa_config_omnipath'}{'SrcDir'}; - return ( -e "$srcdir/INSTALL" ); -} - -sub install_opa_config_omnipath -{ - my $install_list = $_[0]; # total that will be installed when done - my $installing_list = $_[1]; # what items are being installed/reinstalled - - my $srcdir=$ComponentInfo{'opa_config_omnipath'}{'SrcDir'}; - NormalPrint("Installing $ComponentInfo{'opa_config_omnipath'}{'Name'}...\n"); - - copy_systool_file("$srcdir/INSTALL", "/sbin/opa_config_omnipath"); - - $ComponentWasInstalled{'opa_config_omnipath'}=1; -} - -sub uninstall_opa_config_omnipath -{ - my $install_list = $_[0]; # total that will be left installed when done - my $uninstalling_list = $_[1]; # what items are being uninstalled - - NormalPrint("Uninstalling $ComponentInfo{'opa_config_omnipath'}{'Name'}...\n") -; - - system("rm -rf $ROOT/sbin/opa_config_omnipath"); - $ComponentWasInstalled{'opa_config_omnipath'}=0; -} - -my $allow_install; -if ( my_basename($0) ne "INSTALL" ) -{ - $allow_install=0; -} else { - $allow_install=1; -} - -# -# Check if all basic requirements are ok -# -sub verify_os_ver -{ - determine_os_version; - #my $supported_kernel; - # - #if (!$allow_install) - #{ - # my $catkernels = `cat $ROOT$BASE_DIR/supported_kernels`; - # @supported_kernels = split( / +/, $catkernels); - #} else { - # system("echo -n @supported_kernels > ./config/supported_kernels"); - #} - # - #foreach my $supported_kernel_path ( @supported_kernels ) - #{ - # $supported_kernel = my_basename($supported_kernel_path); - # - # $module_dirs[++$#module_dirs] = "/lib/modules/$supported_kernel"; - #} -} - -# TBD can we generalize and combine with ibaccess_main.pl function -sub verify_distrib -{ - my $supported_arch=`cat ./arch 2>/dev/null`; - chomp($supported_arch); - my $supported_distro_vendor=`cat ./distro 2>/dev/null`; - chomp($supported_distro_vendor); - my $supported_distro_vendor_ver=`cat ./distro_version 2>/dev/null`; - chomp($supported_distro_vendor_ver); - - if ( "$supported_arch" eq "" || $supported_distro_vendor eq "" - || $supported_distro_vendor_ver eq "") { - NormalPrint "Unable to proceed: installation image corrupted or install not run as ./INSTALL\n"; - NormalPrint "INSTALL must be run from within untar'ed install image directory\n"; - Abort "Please contact your support representative...\n"; - } - - my $archname; - my $supported_archname; - if ( "$supported_arch" ne "$ARCH" - || "$supported_distro_vendor" ne "$CUR_DISTRO_VENDOR" - || ("$supported_distro_vendor_ver" ne "$CUR_VENDOR_VER" - && "$supported_distro_vendor_ver" ne "$CUR_VENDOR_MAJOR_VER")) - { - #LogPrint "Unable to proceed, $CUR_DISTRO_VENDOR $CUR_VENDOR_VER not supported by $INT_VERSION media\n"; - - $archname=$ARCH; - if ( $ARCH eq "IA32") { - $archname="the Pentium Family"; - } - if ( $ARCH eq "IA64" ) { - $archname="the Itanium family"; - } - if ( $ARCH eq "X86_64" ) { - $archname="the EM64T or Opteron"; - } - - NormalPrint "$CUR_DISTRO_VENDOR $CUR_VENDOR_VER for $archname is not supported by this installation\n"; - NormalPrint "This installation supports the following Linux Distributions:\n"; - $supported_archname=$ARCH; - if ( $supported_arch eq "IA32") { - $supported_archname="the Pentium Family"; - } - if ( $supported_arch eq "IA64" ) { - $supported_archname="the Itanium family"; - } - if ( $supported_arch eq "X86_64" ) { - $supported_archname="the EM64T or Opteron"; - } - NormalPrint "For $supported_arch: $supported_distro_vendor.$supported_distro_vendor_ver\n"; - if ( $Force_Install ) { - NormalPrint "Installation Forced, will proceed with risk of undefined results\n"; - HitKeyCont; - } else { - Abort "Please contact your support representative...\n"; - } - } -} - -sub Usage -{ - if ( $allow_install ) { - printf STDERR "Usage: $0 [-r root] [-v|-vv] [-a|-U|-u|-O|-N|-i comp|-e comp] [--without-depcheck] [--force] [--answer keyword=value]\n"; - } else { - printf STDERR "Usage: $0 [-r root] [-v|-vv] [-u|-e comp] [--answer keyword=value]\n"; - } - printf STDERR " or\n"; - printf STDERR "Usage: $0 -C\n"; - printf STDERR " or\n"; - printf STDERR "Usage: $0 -V\n"; - if ( $allow_install ) { - printf STDERR " -a - install all ULPs and drivers with default options\n"; - #printf STDERR " -n - install all ULPs and drivers with default options\n"; - #printf STDERR " but with no change to autostart options\n"; - printf STDERR " -U - upgrade/re-install all presently installed ULPs and drivers with\n"; - printf STDERR " default options and no change to autostart options\n"; - printf STDERR " -i comp - install the given component with default options\n"; - printf STDERR " can appear more than once on command line\n"; - printf STDERR " --without-depcheck - disable check of OS dependencies\n"; - printf STDERR " --force - force install even if distos don't match\n"; - printf STDERR " Use of this option can result in undefined behaviors\n"; - printf STDERR " -O - Keep current modified rpm config file\n"; - printf STDERR " -N - Use new default rpm config file\n"; - } - printf STDERR " -u - uninstall all ULPs and drivers with default options\n"; - #printf STDERR " -s - enable autostart for all installed drivers\n"; - printf STDERR " -r - specify alternate root directory, default is /\n"; - printf STDERR " -e comp - uninstall the given component with default options\n"; - printf STDERR " can appear more than once on command line\n"; - #printf STDERR " -E comp - enable autostart of given component\n"; - #printf STDERR " can appear with -D or more than once on command line\n"; - #printf STDERR " -D comp - disable autostart of given component\n"; - #printf STDERR " can appear with -E or more than once on command line\n"; - printf STDERR " -v - verbose logging\n"; - printf STDERR " -vv - very verbose debug logging\n"; - printf STDERR " -C - output list of supported components\n"; - printf STDERR " -V - output Version\n"; - showAnswerHelp(); - printf STDERR " default options retain existing configuration files\n"; - printf STDERR " supported component names:\n"; - printf STDERR " "; - foreach my $comp ( @Components ) - { - printf STDERR " $comp"; - } - printf STDERR "\n"; - if (scalar(@SubComponents) > 0) { - printf STDERR " additional component names allowed for -E and -D options:\n"; - printf STDERR " "; - foreach my $comp ( @SubComponents ) - { - printf STDERR " $comp"; - } - printf STDERR "\n"; - } - exit (2); -} - -sub process_args -{ - my $arg; - my $last_arg; - my $setroot = 0; - my $install_opt = 0; - my $setcomp = 0; - my $setanswer = 0; - my $setenabled = 0; - my $setdisabled = 0; - my $comp = 0; - - if (scalar @ARGV >= 1) { - foreach $arg (@ARGV) { - if ( $setroot ) { - $ROOT="$arg"; - if (substr($ROOT,0,1) ne "/") { - printf STDERR "Invalid -r root (must be absolute path): '$ROOT'\n"; - Usage; - } - if (! -d $ROOT) { - printf STDERR "Invalid -r root (directory not found): '$ROOT'\n"; - Usage; - } - $setroot=0; - } elsif ( $setanswer ) { - my @pair = split /=/,$arg; - if ( scalar(@pair) != 2 ) { - printf STDERR "Invalid --answer keyword=value: '$arg'\n"; - Usage; - } - set_answer($pair[0], $pair[1]); - $setanswer=0; - } elsif ( $setcomp ) { - foreach $comp ( @Components ) - { - if ( "$arg" eq "$comp" ) - { - $Default_Components{$arg} = 1; - $setcomp=0; - } - } - if ( $setcomp ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( $setenabled ) { - foreach $comp ( @Components, @SubComponents ) - { - if ( "$arg" eq "$comp" ) - { - $Default_EnabledComponents{$arg} = 1; - $setenabled=0; - } - } - if ( $setenabled ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( $setdisabled ) { - foreach $comp ( @Components, @SubComponents ) - { - if ( "$arg" eq "$comp" ) - { - $Default_DisabledComponents{$arg} = 1; - $setdisabled=0; - } - } - if ( $setdisabled ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( "$arg" eq "-r" ) { - $setroot=1; - } elsif ( "$arg" eq "-v" ) { - $LogLevel=1; - } elsif ( "$arg" eq "-vv" ) { - $LogLevel=2; - } elsif ( "$arg" eq "-i" ) { - $Default_CompInstall=1; - $Default_Prompt=1; - $setcomp=1; - if ($install_opt || $Default_CompUninstall) { - # can't mix -i with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-e" ) { - $Default_CompUninstall=1; - $Default_Prompt=1; - $setcomp=1; - if ($install_opt || $Default_CompInstall) { - # can't mix -e with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - #} elsif ( "$arg" eq "-E" ) { - # $Default_Autostart=1; - # $Default_EnableAutostart=1; - # $Default_Prompt=1; - # $setenabled=1; - #} elsif ( "$arg" eq "-D" ) { - # $Default_Autostart=1; - # $Default_DisableAutostart=1; - # $Default_Prompt=1; - # $setdisabled=1; - } elsif ( "$arg" eq "--without-depcheck" ) { - $rpm_check_dependencies=0; - } elsif ( "$arg" eq "--answer" ) { - $setanswer=1; - } elsif ( "$arg" eq "--force" ) { - $Force_Install=1; - } elsif ( "$arg" eq "-C" ) { - ShowComponents; - exit(0); - } elsif ( "$arg" eq "-V" ) { - printf "$VERSION\n"; - exit(0); - } else { - # Install options - if ( "$arg" eq "-a" ) { - $Default_Install=1; - } elsif ( "$arg" eq "-u" ) { - $Default_Uninstall=1; - #} elsif ( "$arg" eq "-s" ) { - # $Default_Autostart=1; - #} elsif ( "$arg" eq "-n" ) { - # $Default_Install=1; - # $Default_SameAutostart=1; - } elsif ( "$arg" eq "-U" ) { - $Default_Upgrade=1; - $Default_SameAutostart=1; - } elsif ("$arg" eq "-O") { - $Default_RpmConfigKeepOld=1; - $Default_RpmConfigUseNew=0; - } elsif ("$arg" eq "-N") { - $Default_RpmConfigKeepOld=0; - $Default_RpmConfigUseNew=1; - } else { - printf STDERR "Invalid option: $arg\n"; - Usage; - } - if ($install_opt || $Default_CompInstall - || $Default_CompUninstall) { - # only one of the above install selections - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - $install_opt=1; - $Default_Prompt=1; - } - $last_arg=$arg; - } - } - if ( $setroot || $setcomp || $setenabled || $setdisabled || $setanswer) { - printf STDERR "Missing argument for option: $last_arg\n"; - Usage; - } - if ( ($Default_Install || $Default_CompInstall || $Default_Upgrade - || $Force_Install) - && ! $allow_install) { - printf STDERR "Installation options not permitted in this mode\n"; - Usage; - } -} - -my @INSTALL_CHOICES = (); -sub show_menu -{ - my $inp; - my $max_inp; - - @INSTALL_CHOICES = (); - if ( $Default_Install ) { - NormalPrint ("Installing All OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ( $Default_CompInstall ) { - NormalPrint ("Installing Selected OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ( $Default_Upgrade ) { - NormalPrint ("Upgrading/Re-Installing OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ($Default_Uninstall ) { - NormalPrint ("Uninstalling All OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 2); - } - if ($Default_CompUninstall ) { - NormalPrint ("Uninstalling Selected OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 2); - } - #if ($Default_Autostart) { - # NormalPrint ("Configuring autostart for Selected installed OPA Drivers\n"); - # @INSTALL_CHOICES = ( @INSTALL_CHOICES, 3); - #} - if (scalar(@INSTALL_CHOICES) > 0) { - return; - } -START: - system "clear"; - printf ("$BRAND OPA $VERSION Software\n\n"); - if ($allow_install) { - printf (" 1) Install/Uninstall Software\n"); - } else { - printf (" 1) Show Installed Software\n"); - } - #printf (" 2) Reconfigure Driver Autostart \n"); - $max_inp=1; - if (!$allow_install) - { - printf (" 2) Uninstall Software\n"); - $max_inp=2; - } - printf ("\n X) Exit\n"); - - - $inp = getch(); - - if ($inp =~ /[qQ]/ || $inp =~ /[Xx]/ ) { - @INSTALL_CHOICES = ( 99999 ); # indicates exit, none selected - return; - } - if (ord($inp) == $KEY_ENTER) { - goto START; - } - - if ($inp =~ /[0123456789abcdefABCDEF]/) - { - $inp = hex($inp); - } - - if ($inp < 1 || $inp > $max_inp) - { -# printf ("Invalid choice...Try again\n"); - goto START; - } - @INSTALL_CHOICES = ( $inp ); -} - -process_args; -check_root_user; -open_log(""); -verify_os_ver; -verify_modtools; -set_libdir; -if ($allow_install) { - verify_distrib; -} - -RESTART: -show_menu; - -foreach my $INSTALL_CHOICE ( @INSTALL_CHOICES ) -{ - if ($allow_install && $INSTALL_CHOICE == 1) - { - select_debug_release("."); - show_install_menu(1); - if (! $Default_Prompt) { - goto RESTART; - } else { - if ($exit_code == 0) { - print "Done Installing OPA Software.\n" - } else { - print "Failed to install all OPA software.\n" - } - } - } - elsif ($INSTALL_CHOICE == 1) { - show_installed(1); - goto RESTART; - } - elsif ($INSTALL_CHOICE == 2) - { - show_uninstall_menu(1); - if (! $Default_Prompt ) { - goto RESTART; - } else { - if ($exit_code == 0) { - print "Done Uninstalling OPA Software.\n" - } else { - print "Failed to uninstall all OPA Software.\n" - } - } - } - #elsif ($INSTALL_CHOICE == 2) - #{ - # reconfig_autostart; - # if (! $Default_Prompt ) { - # goto RESTART; - # } else { - # print "Done OPA Driver Autostart Configuration.\n" - # } - #} -} -close_log; -exit $exit_code; diff --git a/CommonInstall/main_omnipathwrap.pl b/CommonInstall/main_omnipathwrap.pl deleted file mode 100644 index e6a23f90..00000000 --- a/CommonInstall/main_omnipathwrap.pl +++ /dev/null @@ -1,1267 +0,0 @@ -#!/usr/bin/perl -# BEGIN_ICS_COPYRIGHT8 **************************************** -# -# Copyright (c) 2015, Intel Corporation -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# END_ICS_COPYRIGHT8 **************************************** - -# [ICS VERSION STRING: unknown] -use strict; -#use Term::ANSIColor; -#use Term::ANSIColor qw(:constants); -#use File::Basename; -#use Math::BigInt; - -# =========================================================================== -# Main menus, option handling and version handling for FF for OFED install -# - -$MainInstall="omnipathwrap"; - -@supported_kernels = ( $CUR_OS_VER ); # TBD how do we verify OS -my $Build_OsVer=$CUR_OS_VER; -my $Build_Debug=0; # should we provide more info for debug -my $Build_Temp=""; # temp area to use for build -my $Default_Build = 0; # -B option used to select build -my $Build_Force = 0;# rebuild option used to force full rebuild - -$FirstIPoIBInterface=0; # first device is ib0 - - # Names of supported install components - # must be listed in depdency order such that prereqs appear 1st - -my @OmniPathAllComponents = ( "mvapich2_gcc_hfi", - "mvapich2_intel_hfi", - "mvapich2_pgi_hfi", - "openmpi_gcc_hfi", - "openmpi_intel_hfi", - "openmpi_pgi_hfi", - ); - -# these are now gone, list them so they get uninstalled -@Components = ( "opa_stack", "mpi_selector", "intel_hfi", - "ib_wfr_lite", - "oftools", "opa_stack_dev", "fastfabric", - "ofed_ipoib", "ofed_ib_bonding", "opafm", "opamgt_sdk", - @OmniPathAllComponents, - "gasnet", "openshmem", - "mvapich2", "openmpi", - "ofed_mpisrc", "ofed_udapl", "ofed_rds", - "ofed_srp", "ofed_srpt", "ofed_iser", - "ofed_nfsrdma", "ofed_debug", ); - -# ofed_debug must be last - -@SubComponents = ( "opafm_snmp" ); - - # an additional "special" component which is always installed when - # we install/upgrade anything and which is only uninstalled when everything - # else has been uninstalled. Typically this will be the opaconfig - # file and related files absolutely required by it (such as wrapper_version) -$WrapperComponent = "opaconfig"; - -# This provides more detailed information about each Component in @Components -# since hashes are not retained in the order specified, we still need -# @Components and @SubComponents to control install and menu order -# Fields are as follows: -# Name => full name of component/subcomponent for prompts -# DefaultInstall => default installation (State_DoNotInstall or State_Install) -# used only when available and ! installed -# SrcDir => directory name within install media for component -# DriverSubdir => directory within /lib/modules/$CUR_OS_VERSION/ to -# install driver to. Set to "" if no drivers in component -# set to "." if no subdir -# PreReq => other components which are prereqs of a given -# component/subcomponent -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# CoReq => other components which are coreqs of a given component -# Note that CoReqs can also be listed as prereqs to provide -# install verification as each component is installed, -# however prereqs should only refer to items earlier in the list -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# Hidden => component should not be shown in menus/prompts -# used for hidden PreReq. Hidden components can't HasStart -# nor HasFirmware -# Disabled => components/subcomponents which are disabled from installation -# HasStart => components/subcomponents which have autostart capability -# DefaultStart => should autostart default to Enable (1) or Disable (0) -# Not needed/ignored unless HasStart=1 -# StartPreReq => other components/subcomponents which must be autostarted -# before autostarting this component/subcomponent -# Not needed/ignored unless HasStart=1 -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# StartComponents => components/subcomponents with start for this component -# if a component has a start script -# list the component as a subcomponent of itself -# HasFirmware => components which need HCA firmware update after installed -# -# Note both Components and SubComponents are included in the list below. -# Components require all fields be supplied -# SubComponents only require the following fields: -# Name, PreReq (should reference only components), HasStart, StartPreReq, -# DefaultStart -%ComponentInfo = ( - # our special WrapperComponent, limited use - "opaconfig" => { Name => "opaconfig", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => "", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, - StartPreReq => "", - StartComponents => [ ], - }, - # "ofed" is only used for source_comp - "ofed" => { Name => "OFA", - SrcDir => file_glob("./IntelOPA-OFED.*"), - }, - "opa_stack" => { Name => "OFA OPA Stack", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "updates", - PreReq => "", CoReq => " oftools ", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => "", - StartComponents => [ "opa_stack" ], - }, - "intel_hfi" => { Name => "Intel HFI Components", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => " oftools ", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "intel_hfi" ], - }, - "ib_wfr_lite" => { Name => "WFR Lite driver", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => " oftools ", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ib_wfr_lite" ], - }, - "oftools" => { Name => "OPA Tools", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-Tools*.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => " opa_stack ", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 1, DefaultStart => 0, - StartPreReq => " opa_stack ", # TBD - StartComponents => [ ], - }, - "mpi_selector" => { Name => "MPI selector", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 1, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opa_stack_dev" => { Name => "OFA OPA Development", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "fastfabric" => { Name => "FastFabric", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-Tools*.*"), - DriverSubdir => "", - PreReq => " opa_stack oftools ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ ], - }, - "ofed_ipoib" => { Name => "OFA IP over IB", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_ipoib" ], - }, - "ofed_ib_bonding" => { Name => "OFA IB Bonding", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "", - PreReq => " opa_stack ofed_ipoib ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "ofed_rds" => { Name => "OFA RDS", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "updates", - PreReq => " opa_stack ofed_ipoib ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_rds" ], - }, - "ofed_udapl" => { Name => "OFA uDAPL", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "", - PreReq => " opa_stack ofed_ipoib ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mvapich2" => { Name => "MVAPICH2 (verbs,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "", - PreReq => " opa_stack mpi_selector intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi" => { Name => "OpenMPI (verbs,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "", - PreReq => " opa_stack mpi_selector intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "gasnet" => { Name => "GASNet (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openshmem" => { Name => "OpenSHMEM (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "", - PreReq => " opa_stack gasnet intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mvapich2_gcc_hfi" => { Name => "MVAPICH2 (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mvapich2_pgi_hfi" => { Name => "MVAPICH2 (hfi,PGI)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mvapich2_intel_hfi" => { Name => "MVAPICH2 (hfi,Intel)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi_gcc_hfi" => { Name => "OpenMPI (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi_pgi_hfi" => { Name => "OpenMPI (hfi,PGI)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi_intel_hfi" => { Name => "OpenMPI (hfi,Intel)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "ofed_mpisrc" =>{ Name => "MPI Source", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "", - PreReq => " opa_stack opa_stack_dev mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "ofed_srp" => { Name => "OFA SRP", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_srp" ], - }, - "ofed_srpt" => { Name => "OFA SRP Target", - DefaultInstall => $State_DoNotAutoInstall, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, Default_Start => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_srpt" ], - }, - "opafm" => { Name => "OPA FM", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-FM.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - #StartComponents => [ "qlgc_fm", "qlgc_fm_snmp"], - StartComponents => [ "opafm" ], - }, - # opafm_snmp is a subcomponent - # it is a tool with startup and config, but is part of opafm - "opafm_snmp" => { Name => "OPA FM SNMP Agent", - PreReq => " opa_stack opafm ", CoReq => "", - HasStart => 1, DefaultStart => 0, - StartPreReq => " opa_stack opafm ", - StartComponents => [ "opafm_snmp" ], - }, - "opamgt_sdk" => { Name => "OPA Management SDK", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-Tools*.*"), - DriverSubdir => "", - Prereq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ ], - }, - "ofed_iser" => { Name => "OFA iSER", - DefaultInstall => $State_DoNotInstall, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "ofed_iser" ], - }, - "ofed_nfsrdma" =>{ Name => "OFA NFS RDMA", - DefaultInstall => $State_DoNotAutoInstall, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "updates", - PreReq => " opa_stack ofed_ipoib ", CoReq => "", - # for now, skip startup option for nfs and nfslock - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "ofed_debug" => { Name => "OFA Debug Info", - DefaultInstall => $State_DoNotInstall, - SrcDir => file_glob("./IntelOPA-OFED.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - ); - # translate from startup script name to component/subcomponent name -%StartupComponent = ( - "openibd" => "opa_stack", - "opafm" => "opafm", - "opafm_snmpd" => "opafm_snmp", - ); - # has component been loaded since last configured autostart -%ComponentWasInstalled = ( - "opa_stack" => 0, - "oftools" => 0, - "mpi_selector" => 0, - "opa_stack_dev" => 0, - "fastfabric" => 0, - "ofed_ipoib" => 0, - "ofed_ib_bonding" => 0, - "ofed_rds" => 0, - "ofed_udapl" => 0, - "mvapich2" => 0, - "openmpi" => 0, - "mvapich2_gcc_hfi" => 0, - "mvapich2_pgi_hfi" => 0, - "mvapich2_intel_hfi" => 0, - "openmpi_gcc_hfi" => 0, - "openmpi_pgi_hfi" => 0, - "openmpi_intel_hfi" => 0, - "ofed_mpisrc" => 0, - "ofed_srp" => 0, - "ofed_srpt" => 0, - "opafm" => 0, - "opamgt_sdk" => 0, - "ofed_iser" => 0, - "ofed_nfsrdma" => 0, - "ofed_debug" => 0, - ); - -# ========================================================================== -# opaconfig installation -# This is a special WrapperComponent which only needs: -# available, install and uninstall -# it cannot have startup scripts, dependencies, prereqs, etc - -sub available_opaconfig -{ - my $srcdir=$ComponentInfo{'opaconfig'}{'SrcDir'}; - return ( -e "$srcdir/INSTALL" ); -} - -sub install_opaconfig -{ - my $install_list = $_[0]; # total that will be installed when done - my $installing_list = $_[1]; # what items are being installed/reinstalled - - my $srcdir=$ComponentInfo{'opaconfig'}{'SrcDir'}; - NormalPrint("Installing $ComponentInfo{'opaconfig'}{'Name'}...\n"); - - check_config_dirs(); - # remove the old style version file - system("rm -rf $ROOT/$BASE_DIR/version"); - # version_wrapper is only for support (fetched in opacapture) - system("echo '$VERSION' > $BASE_DIR/version_wrapper 2>/dev/null"); - copy_data_file("$srcdir/os_id", "$BASE_DIR/osid_wrapper"); - # there is no ideal answer here, if we install updates separately - # then upgrade or reinstall with wrapper, make sure we cleanup possibly old - # opaconfig_* files - system("rm -rf $ROOT/sbin/opa_config_ff"); - system("rm -rf $ROOT/sbin/opa_config_fm"); - system("rm -rf $ROOT/sbin/opa_config_srp"); - system("rm -rf $ROOT/sbin/opa_config_vnic"); - system("rm -rf $ROOT/sbin/opa_config_ofed"); - - $ComponentWasInstalled{'opaconfig'}=1; -} - -sub uninstall_opaconfig -{ - my $install_list = $_[0]; # total that will be left installed when done - my $uninstalling_list = $_[1]; # what items are being uninstalled - - NormalPrint("Uninstalling $ComponentInfo{'opaconfig'}{'Name'}...\n"); - system("rm -rf $ROOT$BASE_DIR/version_wrapper"); - system("rm -rf $ROOT$BASE_DIR/osid_wrapper"); - # remove the old style version file - system("rm -rf $ROOT/$BASE_DIR/version"); - system("rm -rf $ROOT/sbin/opaconfig"); - # there is no ideal answer here, if we install updates separately - # then uninstall all with wrapper, make sure we cleanup - system("rm -rf $ROOT/sbin/opa_config_ff"); - system("rm -rf $ROOT/sbin/opa_config_fm"); - system("rm -rf $ROOT/sbin/opa_config_srp"); - system("rm -rf $ROOT/sbin/opa_config_vnic"); - system("rm -rf $ROOT/sbin/opa_config_ofed"); - system "rmdir $ROOT$BASE_DIR 2>/dev/null"; # remove only if empty - system "rmdir $ROOT$OPA_CONFIG_DIR 2>/dev/null"; # remove only if empty - $ComponentWasInstalled{'opaconfig'}=0; -} - -# source a component specific comp.pl file which will provide the -# API for managing the component's installation state -sub source_comp -{ - my($comp)=$_[0]; - my($allow_install)=$_[1]; # if not INSTALL, don't use present dir - #print "$comp: $ComponentInfo{$comp}{'SrcDir'}/comp.pl\n"; sleep 10; - if ( $allow_install && -e "$ComponentInfo{$comp}{'SrcDir'}/comp.pl" ) { - # TBD - odd that require treats as package, do seems to not eval - # the ugly eval approach seems to work - #do "$ComponentInfo{$comp}{'SrcDir'}/comp.pl"; - #print "do $ComponentInfo{$comp}{'SrcDir'}/comp.pl\n"; sleep 5; - #require "$ComponentInfo{$comp}{'SrcDir'}/comp.pl"; - #do "$ComponentInfo{$comp}{'SrcDir'}/comp.pl"; - # print "$ComponentInfo{$comp}{'SrcDir'}/comp.pl\n"; sleep 10; - eval `cat "$ComponentInfo{$comp}{'SrcDir'}/comp.pl"`; - if ( "$@" ne "" ) { - NormalPrint "$@\n"; - Abort "Corrupted $ComponentInfo{$comp}{'Name'} script: $ComponentInfo{$comp}{'SrcDir'}/comp.pl"; - } else { - LogPrint "Loaded $ComponentInfo{$comp}{'Name'} script: $ComponentInfo{$comp}{'SrcDir'}/comp.pl\n"; - } - #eval "available_$comp"; - } elsif ( -e "$ROOT/usr/lib/opa/.comp_$comp.pl" ) { - # source the installed file, mainly to aid uninstall - #print "$ROOT/usr/lib/opa/.comp_$comp.pl\n"; sleep 10; - eval `cat "$ROOT/usr/lib/opa/.comp_$comp.pl"`; - if ( "$@" ne "" ) { - NormalPrint "$@\n"; - NormalPrint "Warning: Ignoring Corrupted $ComponentInfo{$comp}{'Name'} script: $ROOT/usr/lib/opa/.comp_$comp.pl\n"; - HitKeyCont; - } else { - LogPrint "Loaded $ComponentInfo{$comp}{'Name'} script: $ROOT/usr/lib/opa/.comp_$comp.pl\n"; - } - } else { - # component not available and not installed - LogPrint "$ComponentInfo{$comp}{'Name'} script not available\n"; - } -} - -my $allow_install; -if ( my_basename($0) ne "INSTALL" ) -{ - $allow_install=0; -} else { - $allow_install=1; - $FabricSetupScpFromDir=".."; -} - -# -# Check if all basic requirements are ok -# -sub verify_os_ver -{ - determine_os_version; - #my $supported_kernel; - # - #if (!$allow_install) - #{ - # my $catkernels = `cat $ROOT$BASE_DIR/supported_kernels`; - # @supported_kernels = split( / +/, $catkernels); - #} else { - # system("echo -n @supported_kernels > ./config/supported_kernels"); - #} - # - #foreach my $supported_kernel_path ( @supported_kernels ) - #{ - # $supported_kernel = my_basename($supported_kernel_path); - # - # $module_dirs[++$#module_dirs] = "/lib/modules/$supported_kernel"; - #} - # make sure current OS version included so remove_driver works - $module_dirs[++$#module_dirs] = "/lib/modules/$CUR_OS_VER"; -} - -sub Usage -{ - if ( $allow_install ) { -# printf STDERR "Usage: $0 [-r root] [-v|-vv] [-a|-n|-U|-F|-u|-s|-i comp|-e comp] [-E comp] [-D comp] [-f] [--fwupdate asneeded|always] [--user_configure_options 'options'] [--kernel_configure_options 'options'] [--prefix dir] [--without-depcheck] [--rebuild] [--force] [--answer keyword=value]\n"; - printf STDERR "Usage: $0 [-r root] [-v|-vv] [-a|-n|-U|-u|-s|-i comp|-e comp] [-E comp] [-D comp] [--user_configure_options 'options'] [--kernel_configure_options 'options'] [--prefix dir] [--without-depcheck] [--rebuild] [--force] [--answer keyword=value]\n"; - } else { -# printf STDERR "Usage: $0 [-r root] [-v|-vv] [-F|-u|-s|-e comp] [-E comp] [-D comp]\n"; -# printf STDERR " [--fwupdate asneeded|always] [--user_queries|--no_user_queries] [--answer keyword=value]\n"; - printf STDERR "Usage: $0 [-r root] [-v|-vv] [-u|-s|-e comp] [-E comp] [-D comp]\n"; - printf STDERR " [--user_queries|--no_user_queries] [--answer keyword=value]\n"; - } - printf STDERR " or\n"; - printf STDERR "Usage: $0 -C\n"; - printf STDERR " or\n"; - printf STDERR "Usage: $0 -V\n"; - if ( $allow_install ) { - printf STDERR " -a - install all ULPs and drivers with default options\n"; - printf STDERR " -n - install all ULPs and drivers with default options\n"; - printf STDERR " but with no change to autostart options\n"; - printf STDERR " -U - upgrade/re-install all presently installed ULPs and drivers with\n"; - printf STDERR " default options and no change to autostart options\n"; - printf STDERR " -i comp - install the given component with default options\n"; - printf STDERR " can appear more than once on command line\n"; -# printf STDERR " -f - skip HCA firmware upgrade during install\n"; - #printf STDERR " -l - skip creating/removing symlinks to /usr/local from /usr/lib/opa\n"; - printf STDERR " --user_configure_options 'options' - specify additional OFA build\n"; - printf STDERR " options for user space srpms. Causes rebuild of all user srpms\n"; - printf STDERR " --kernel_configure_options 'options' - specify additional OFA build\n"; - printf STDERR " options for driver srpms. Causes rebuild of all driver srpms\n"; - printf STDERR " --prefix dir - specify alternate directory prefix for install of OFA\n"; - printf STDERR " default is /usr. Causes rebuild of needed srpms\n"; - printf STDERR " --without-depcheck - disable check of OS dependencies\n"; - printf STDERR " --rebuild - force OFA rebuild\n"; - printf STDERR " --force - force install even if distos don't match\n"; - printf STDERR " Use of this option can result in undefined behaviors\n"; - # --debug, -B, -t and -d options are purposely not documented - #printf STDERR " --debug - build a debug version of modules\n"; - #printf STDERR " -B osver - run build for all components targetting kernel osver\n"; - #printf STDERR " -t - temp area for use by builds, only valid with -B\n"; - #printf STDERR " -d - enable build debugging assists, only valid with -B\n"; - #printf STDERR " -R osver - force install for kernel osver rather than running kernel.\n"; - } -# printf STDERR " -F - upgrade HCA Firmware with default options\n"; -# printf STDERR " --fwupdate asneeded|always - select fw update auto update mode\n"; -# printf STDERR " asneeded - update or downgrade to match version in this release\n"; -# printf STDERR " always - rewrite with this releases version even if matches\n"; -# printf STDERR " default is to upgrade as needed but not downgrade\n"; -# printf STDERR " this option is ignored for interactive install\n"; - printf STDERR " -u - uninstall all ULPs and drivers with default options\n"; - printf STDERR " -s - enable autostart for all installed drivers\n"; - printf STDERR " -r - specify alternate root directory, default is /\n"; - printf STDERR " -e comp - uninstall the given component with default options\n"; - printf STDERR " can appear more than once on command line\n"; - printf STDERR " -E comp - enable autostart of given component\n"; - printf STDERR " can appear with -D or more than once on command line\n"; - printf STDERR " -D comp - disable autostart of given component\n"; - printf STDERR " can appear with -E or more than once on command line\n"; - printf STDERR " -v - verbose logging\n"; - printf STDERR " -vv - very verbose debug logging\n"; - printf STDERR " -C - output list of supported components\n"; - printf STDERR " -V - output Version\n"; - - printf STDERR " --user_queries - permit non-root users to query the fabric. (default)\n"; - printf STDERR " --no_user_queries - non root users cannot query the fabric.\n"; - showAnswerHelp(); - - printf STDERR " default options retain existing configuration files\n"; - printf STDERR " supported component names:\n"; - printf STDERR " "; - foreach my $comp ( @Components ) - { - printf STDERR " $comp"; - } - printf STDERR "\n"; - printf STDERR " supported component name aliases:\n"; - printf STDERR " opa ipoib mpi mpisrc udapl rds opadev\n"; - if (scalar(@SubComponents) > 0) { - printf STDERR " additional component names allowed for -E and -D options:\n"; - printf STDERR " "; - foreach my $comp ( @SubComponents ) - { - printf STDERR " $comp"; - } - printf STDERR "\n"; - } - exit (2); -} - -my $Default_FirmwareUpgrade=0; # -F option used to select default firmware upgrade - -# translate an ibaccess component name into the corresponding list of ofed comps -# if the given name is invalid or has no corresponding OFED component -# returns an empty list -sub translate_comp -{ - my($arg)=$_[0]; - if ("$arg" eq "opadev") { return ( "opa_stack_dev" ); - } elsif ("$arg" eq "opa") { return ( "oftools", - "mvapich2_gcc_hfi", "openmpi_gcc_hfi", "mvapich2_intel_hfi", - "openmpi_intel_hfi", "mvapich2_pgi_hfi", "openmpi_pgi_hfi" ); - } elsif ("$arg" eq "fastfabric"){ return ( "fastfabric" ); # unexpected - # marker for ib-bonding so we can postprocess later - } elsif ("$arg" eq "ipoib") { return ( "ofed_ipoib", "ib_bonding_marker" ); - } elsif ("$arg" eq "mpi") { return ( "mvapich2", "openmpi", - "mvapich2_gcc_hfi", "openmpi_gcc_hfi", "mvapich2_intel_hfi", - "openmpi_intel_hfi", "mvapich2_pgi_hfi", "openmpi_pgi_hfi" ); - } elsif ("$arg" eq "mpisrc") { return ( "ofed_mpisrc" ); - } elsif ("$arg" eq "udapl") { return ( "ofed_udapl" ); - } elsif ("$arg" eq "rds") { return ( "ofed_rds" ); - # no ibaccess argument equivalent for: ofed_srpt, ofed_iser, - # openmpi, ofed_iwarp, opensm, opafm, ofed_nfsrdma, ofed_debug - # - } else { - return (); # invalid name - } -} - -sub process_args -{ - my $arg; - my $last_arg; - my $setroot = 0; - my $install_opt = 0; - my $setcomp = 0; - my $setanswer = 0; - my $setenabled = 0; - my $setdisabled = 0; - my $setosver = 0; - my $setbuildtemp = 0; - my $comp = 0; - my $osver = 0; - my $setuseroptions = 0; - my $setcurosver = 0; - my $setkerneloptions = 0; - my $setprefix = 0; - my $setfwmode = 0; - my $patch_ofed=0; - - if (scalar @ARGV >= 1) { - foreach $arg (@ARGV) { - if ( $setroot ) { - $ROOT="$arg"; - if (substr($ROOT,0,1) ne "/") { - printf STDERR "Invalid -r root (must be absolute path): '$ROOT'\n"; - Usage; - } - if (! -d $ROOT) { - printf STDERR "Invalid -r root (directory not found): '$ROOT'\n"; - Usage; - } - $setroot=0; - } elsif ( $setanswer ) { - my @pair = split /=/,$arg; - if ( scalar(@pair) != 2 ) { - printf STDERR "Invalid --answer keyword=value: '$arg'\n"; - Usage; - } - set_answer($pair[0], $pair[1]); - $setanswer=0; - } elsif ( $setcomp ) { - foreach $comp ( @Components ) - { - if ( "$arg" eq "$comp" ) - { - $Default_Components{$arg} = 1; - $setcomp=0; - } - } - if ( $setcomp ) - { - my @comps = translate_comp($arg); - # if empty list returned, we will not clear setcomp and - # will get error below - foreach $comp ( @comps ) - { - $Default_Components{$comp} = 1; - $setcomp=0; - } - } - if ( $setcomp ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( $setenabled ) { - foreach $comp ( @Components, @SubComponents ) - { - if ( "$arg" eq "$comp" ) - { - $Default_EnabledComponents{$arg} = 1; - $setenabled=0; - } - } - if ( $setenabled ) - { - my @comps = translate_comp($arg); - # if empty list returned, we will not clear setcomp and - # will get error below - foreach $comp ( @comps ) - { - $Default_EnabledComponents{$comp} = 1; - $setenabled=0; - } - } - if ( $setenabled ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( $setdisabled ) { - foreach $comp ( @Components, @SubComponents ) - { - if ( "$arg" eq "$comp" ) - { - $Default_DisabledComponents{$arg} = 1; - $setdisabled=0; - } - } - if ( $setdisabled ) - { - my @comps = translate_comp($arg); - # if empty list returned, we will not clear setcomp and - # will get error below - foreach $comp ( @comps ) - { - $Default_DisabledComponents{$comp} = 1; - $setdisabled=0; - } - } - if ( $setdisabled ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( $setosver ) { - $Build_OsVer="$arg"; - $setosver=0; - } elsif ( $setbuildtemp ) { - $Build_Temp="$arg"; - $setbuildtemp=0; - } elsif ( $setuseroptions ) { - $OFED_user_configure_options="$arg"; - $setuseroptions=0; - } elsif ( $setkerneloptions ) { - $OFED_kernel_configure_options="$arg"; - $setkerneloptions=0; - } elsif ( $setprefix ) { - $OFED_prefix="$arg"; - $setprefix=0; -# } elsif ( $setfwmode ) { -# if ( "$arg" eq "always" || "$arg" eq "asneeded") { -# $Default_FirmwareUpgradeMode="$arg"; -# } else { -# printf STDERR "Invalid --fwupdate mode: $arg\n"; -# Usage; -# } -# $setfwmode = 0; - } elsif ( $setcurosver ) { - $CUR_OS_VER="$arg"; - @supported_kernels = ( $CUR_OS_VER ); - $setcurosver=0; - } elsif ( "$arg" eq "-r" ) { - $setroot=1; - } elsif ( "$arg" eq "-v" ) { - $LogLevel=1; - } elsif ( "$arg" eq "-vv" ) { - $LogLevel=2; -# } elsif ( "$arg" eq "-f" ) { -# $Skip_FirmwareUpgrade=1; - } elsif ( "$arg" eq "-i" ) { - $Default_CompInstall=1; - $Default_Prompt=1; - $setcomp=1; - if ($install_opt || $Default_CompUninstall || $Default_Build) { - # can't mix -i with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-e" ) { - $Default_CompUninstall=1; - $Default_Prompt=1; - $setcomp=1; - if ($install_opt || $Default_CompInstall || $Default_Build) { - # can't mix -e with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-E" ) { - $Default_Autostart=1; - $Default_EnableAutostart=1; - $Default_Prompt=1; - $setenabled=1; - if ($Default_Build) { - # can't mix -E with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-D" ) { - $Default_Autostart=1; - $Default_DisableAutostart=1; - $Default_Prompt=1; - $setdisabled=1; - if ($Default_Build) { - # can't mix -D with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "--user_configure_options" ) { - $setuseroptions=1; - } elsif ( "$arg" eq "--kernel_configure_options" ) { - $setkerneloptions=1; - } elsif ( "$arg" eq "--prefix" ) { - $setprefix=1; -# } elsif ( "$arg" eq "--fwupdate" ) { -# $setfwmode=1; - } elsif ( "$arg" eq "--answer" ) { - $setanswer=1; - } elsif ( "$arg" eq "--without-depcheck" ) { - $rpm_check_dependencies=0; - } elsif ( "$arg" eq "--force" ) { - $Force_Install=1; - } elsif ( "$arg" eq "-C" ) { - ShowComponents; - exit(0); - } elsif ( "$arg" eq "-V" ) { - printf "$VERSION\n"; - exit(0); - } elsif ( "$arg" eq "-R" ) { - $setcurosver=1; - } elsif ( "$arg" eq "-B" ) { - # undocumented option to do a build for specific OS - $Default_Build=1; - $Default_Prompt=1; - $setosver=1; - if ($install_opt || $Default_CompInstall || $Default_CompUninstall || $Default_Autostart) { - # can't mix -B with install - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-d" ) { - # undocumented option to aid debug of build - $Build_Debug=1; - if ($install_opt || $Default_CompInstall || $Default_CompUninstall || $Default_Autostart) { - # can't mix -d with install - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-t" ) { - # undocumented option to aid debug of build - $setbuildtemp=1; - if ($install_opt || $Default_CompInstall || $Default_CompUninstall || $Default_Autostart) { - # can't mix -t with install - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "--rebuild" ) { - # force rebuild - $Build_Force=1; - $OFED_force_rebuild=1; - } elsif ( "$arg" eq "--debug" ) { - $OFED_debug=1; - } elsif ( "$arg" eq "--user_queries" ) { - $Default_UserQueries=1; - } elsif ( "$arg" eq "--no_user_queries" ) { - $Default_UserQueries=-1; - } elsif ( "$arg" eq "--patch_ofed" ) { - $patch_ofed=1; - } else { - # Install options - if ( "$arg" eq "-a" ) { - $Default_Install=1; - } elsif ( "$arg" eq "-u" ) { - $Default_Uninstall=1; - } elsif ( "$arg" eq "-s" ) { - $Default_Autostart=1; - } elsif ( "$arg" eq "-n" ) { - $Default_Install=1; - $Default_SameAutostart=1; - } elsif ( "$arg" eq "-U" ) { - $Default_Upgrade=1; - $Default_SameAutostart=1; -# } elsif ( "$arg" eq "-F" ) { -# $Default_FirmwareUpgrade=1; - } else { - printf STDERR "Invalid option: $arg\n"; - Usage; - } - if ($install_opt || $Default_CompInstall - || $Default_CompUninstall) { - # only one of the above install selections - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - $install_opt=1; - $Default_Prompt=1; - } - $last_arg=$arg; - } - } - if ( $setroot || $setcomp || $setenabled || $setdisabled || $setosver || $setbuildtemp || $setuseroptions || $setkerneloptions || $setprefix || $setfwmode || $setanswer) { - printf STDERR "Missing argument for option: $last_arg\n"; - Usage; - } - if ( ($Default_Install || $Default_CompInstall || $Default_Upgrade - || $Force_Install) - && ! $allow_install) { - printf STDERR "Installation options not permitted in this mode\n"; - Usage; - } - if ( ($Default_Build || $OFED_force_rebuild || $OFED_debug - || ($OFED_user_configure_options ne '') - || ($OFED_kernel_configure_options ne '') - || ($OFED_prefix ne '/usr')) - && ! $allow_install) { - printf STDERR "Build options not permitted in this mode\n"; - Usage; - } - if ( $patch_ofed) { - NormalPrint("Patching OFA...\n"); - LogPrint("Executing: cd $ComponentInfo{'opa_stack'}{'SrcDir'}; ./patch_ofed3\n"); - system("cd $ComponentInfo{'opa_stack'}{'SrcDir'}; ./patch_ofed3"); - HitKeyCont; - } -} - -my @INSTALL_CHOICES= (); -sub show_menu -{ - my $inp; - my $max_inp; - - @INSTALL_CHOICES= (); - if ( $Default_Install ) { - NormalPrint ("Installing All OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ( $Default_CompInstall ) { - NormalPrint ("Installing Selected OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ( $Default_Upgrade ) { - NormalPrint ("Upgrading/Re-Installing OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } -# if ( $Default_FirmwareUpgrade ) { -# NormalPrint ("Upgrading HCA Firmware\n"); -# @INSTALL_CHOICES = ( @INSTALL_CHOICES, 4); -# } - if ($Default_Uninstall ) { - NormalPrint ("Uninstalling All OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 6); - } - if ($Default_CompUninstall ) { - NormalPrint ("Uninstalling Selected OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 6); - } - if ($Default_Autostart) { - NormalPrint ("Configuring autostart for Selected installed OPA Drivers\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 3); - } - if (scalar(@INSTALL_CHOICES) > 0) { - return; - } -START: - system "clear"; - printf ("$BRAND OPA $VERSION Software\n\n"); - if ($allow_install) { - printf (" 1) Install/Uninstall Software\n"); - } else { - printf (" 1) Show Installed Software\n"); - } - printf (" 2) Reconfigure $ComponentInfo{'ofed_ipoib'}{'Name'}\n"); - printf (" 3) Reconfigure Driver Autostart \n"); - printf (" 4) Generate Supporting Information for Problem Report\n"); - printf (" 5) FastFabric (Host/Chassis/Switch Setup/Admin)\n"); -# printf (" 6) Update HCA Firmware\n"); - $max_inp=5; - if (!$allow_install) - { -# printf (" 7) Uninstall Software\n"); - printf (" 6) Uninstall Software\n"); - $max_inp=6; - } - printf ("\n X) Exit\n"); - - - $inp = getch(); - - if ($inp =~ /[qQ]/ || $inp =~ /[Xx]/ ) { - @INSTALL_CHOICES = ( 99999 ); # indicates exit, none selected - return; - } - if (ord($inp) == $KEY_ENTER) { - goto START; - } - - if ($inp =~ /[0123456789abcdefABCDEF]/) - { - $inp = hex($inp); - } - - if ($inp < 1 || $inp > $max_inp) - { -# printf ("Invalid choice...Try again\n"); - goto START; - } - @INSTALL_CHOICES = ( $inp ); -} - -process_args; -check_root_user; -if ( ! $Default_Build ) { - open_log(""); -} else { - open_log("./build.log"); -} - -source_comp("ofed", $allow_install); -source_comp("oftools", $allow_install); # allow oftools installed w/o fastfabric -source_comp("fastfabric", $allow_install); -source_comp("opafm", $allow_install); - -if ( ! $Default_Build ) { - verify_os_ver; - verify_modtools; - if ($allow_install) { - verify_distrib_files; - } -} else { - determine_os_version; -} - -foreach my $comp ( @OmniPathAllComponents ) -{ - $ComponentInfo{$comp}{'DefaultInstall'} = $State_Install; - $Default_EnabledComponents{$comp} = 1; -} - -# post process ib_bonding_marker selection via command line args so -# can check Available for ib-bonding -if ( $Default_Components{'ib_bonding_marker'} ) { - if ( comp_is_available('ofed_ib_bonding') ) { - $Default_Components{'ofed_ib_bonding'} = 1; - } -} -if ( $Default_EnabledComponents{'ib_bonding_marker'} ) { - if ( comp_is_available('ofed_ib_bonding') ) { - $Default_EnabledComponents{'ofed_ib_bonding'} = 1; - } -} -if ( $Default_DisabledComponents{'ib_bonding_marker'} ) { - if ( comp_is_available('ofed_ib_bonding') ) { - $Default_DisabledComponents{'ofed_ib_bonding'} = 1; - } -} - -set_libdir; -init_ofed_rpm_info($CUR_OS_VER); - -RESTART: -if ($Default_Build) { - $exit_code = build_all_components($Build_OsVer, $Build_Debug, $Build_Temp, $Build_Force); - goto DONE; -} else { - show_menu; -} - -foreach my $INSTALL_CHOICE ( @INSTALL_CHOICES ) -{ - if ($allow_install && $INSTALL_CHOICE == 1) - { - select_debug_release("."); - show_install_menu(1); - if (! $Default_Prompt) { - goto RESTART; - } else { - if ($exit_code == 0) { - print "Done Installing OPA Software.\n" - } else { - print "Failed to install all OPA software.\n" - } - } - } - elsif ($INSTALL_CHOICE == 1) { - show_installed(1); - goto RESTART; - } - elsif ($INSTALL_CHOICE == 6) - { - show_uninstall_menu(1); - if (! $Default_Prompt ) { - goto RESTART; - } else { - if ($exit_code == 0) { - print "Done Uninstalling OPA Software.\n" - } else { - print "Failed to uninstall all OPA Software.\n" - } - } - } - elsif ($INSTALL_CHOICE == 2) - { - Config_ifcfg(1,"$ComponentInfo{'ofed_ipoib'}{'Name'}","ib", "$FirstIPoIBInterface",1); - check_network_config; - #Config_IPoIB_cfg; - goto RESTART; - } - elsif ($INSTALL_CHOICE == 3) - { - reconfig_autostart; - if (! $Default_Prompt ) { - goto RESTART; - } else { - print "Done OPA Driver Autostart Configuration.\n" - } - } -# elsif ($INSTALL_CHOICE == 6) -# { -# # Update HFI Firmware -# update_hca_firmware; -# if (! $Default_Prompt ) { -# goto RESTART; -# } else { -# print "Done HFI Firmware Update.\n" -# } -# } - elsif ($INSTALL_CHOICE == 4) - { - # Generate Supporting Information for Problem Report - capture_report($ComponentInfo{'oftools'}{'Name'}); - goto RESTART; - } - elsif ($INSTALL_CHOICE == 5) - { - # FastFabric (Host/Chassis/Switch Setup/Admin) - if ( "$ROOT" eq "" || "$ROOT" eq "/" ) { - run_fastfabric($ComponentInfo{'fastfabric'}{'Name'}); - } else { - print "Unable to run fastfabric when using an alternate root (-r)\n"; - HitKeyCont; - } - goto RESTART; - } -} -DONE: -close_log; -exit $exit_code; diff --git a/CommonInstall/main_omnipathwrap_delta.pl b/CommonInstall/main_omnipathwrap_delta.pl index 6b00a7c7..01738d8a 100644 --- a/CommonInstall/main_omnipathwrap_delta.pl +++ b/CommonInstall/main_omnipathwrap_delta.pl @@ -39,852 +39,135 @@ # Main menus, option handling and version handling for FF for OFED install # -$MainInstall="omnipathwrap"; - -@supported_kernels = ( $CUR_OS_VER ); # TBD how do we verify OS -my $Build_OsVer=$CUR_OS_VER; -my $Build_Debug=0; # should we provide more info for debug -my $Build_Temp=""; # temp area to use for build -my $Default_Build = 0; # -B option used to select build -my $Build_Force = 0;# rebuild option used to force full rebuild - -$FirstIPoIBInterface=0; # first device is ib0 - - # Names of supported install components - # must be listed in depdency order such that prereqs appear 1st - -my @OmniPathAllComponents = ( "mvapich2_gcc_hfi", - "mvapich2_intel_hfi", - "openmpi_gcc_hfi", - "openmpi_intel_hfi", - ); - -# these are now gone, list them so they get uninstalled -my @Components_other = ( "opa_stack", "ibacm", "mpi_selector", "intel_hfi", - "oftools", "opa_stack_dev", "fastfabric", "rdma_ndd", - "delta_ipoib", "opafm", "opamgt_sdk", - @OmniPathAllComponents, - "gasnet", "openshmem", - "mvapich2", "openmpi", - "delta_mpisrc", "hfi1_uefi", "delta_debug", ); -my @Components_rhel72 = ( "opa_stack", "ibacm", "mpi_selector", "intel_hfi", - "oftools", "opa_stack_dev", "fastfabric", "rdma_ndd", - "delta_ipoib", "opafm", "opamgt_sdk", - @OmniPathAllComponents, - "openmpi_gcc_cuda_hfi", "gasnet", "openshmem", - "mvapich2", "openmpi", - "delta_mpisrc", "hfi1_uefi", "delta_debug", ); -my @Components_sles12_sp2 = ( "opa_stack", "ibacm", "mpi_selector", "intel_hfi", - "oftools", "opa_stack_dev", "fastfabric", "rdma_ndd", - "delta_ipoib", "opafm", "opamgt_sdk", - @OmniPathAllComponents, - "openmpi_gcc_cuda_hfi", "gasnet", "openshmem", - "mvapich2", "openmpi", - "delta_mpisrc", "hfi1_uefi", "delta_debug", ); -my @Components_rhel73 = ( "opa_stack", "ibacm", "mpi_selector", "intel_hfi", - "oftools", "opa_stack_dev", "fastfabric", "rdma_ndd", - "delta_ipoib", "opafm", "opamgt_sdk", - @OmniPathAllComponents, - "openmpi_gcc_cuda_hfi", "gasnet", "openshmem", - "mvapich2", "openmpi", - "delta_mpisrc", "hfi1_uefi", "delta_debug", ); -@Components = ( ); - -# delta_debug must be last - -@SubComponents = ( ); - - # an additional "special" component which is always installed when - # we install/upgrade anything and which is only uninstalled when everything - # else has been uninstalled. Typically this will be the opaconfig - # file and related files absolutely required by it (such as wrapper_version) -$WrapperComponent = "opaconfig"; - -# This provides more detailed information about each Component in @Components -# since hashes are not retained in the order specified, we still need -# @Components and @SubComponents to control install and menu order -# Fields are as follows: -# Name => full name of component/subcomponent for prompts -# DefaultInstall => default installation (State_DoNotInstall or State_Install) -# used only when available and ! installed -# SrcDir => directory name within install media for component -# DriverSubdir => directory within /lib/modules/$CUR_OS_VERSION/ to -# install driver to. Set to "" if no drivers in component -# set to "." if no subdir -# PreReq => other components which are prereqs of a given -# component/subcomponent -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# CoReq => other components which are coreqs of a given component -# Note that CoReqs can also be listed as prereqs to provide -# install verification as each component is installed, -# however prereqs should only refer to items earlier in the list -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# Hidden => component should not be shown in menus/prompts -# used for hidden PreReq. Hidden components can't HasStart -# nor HasFirmware -# Disabled => components/subcomponents which are disabled from installation -# HasStart => components/subcomponents which have autostart capability -# DefaultStart => should autostart default to Enable (1) or Disable (0) -# Not needed/ignored unless HasStart=1 -# StartPreReq => other components/subcomponents which must be autostarted -# before autostarting this component/subcomponent -# Not needed/ignored unless HasStart=1 -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# StartComponents => components/subcomponents with start for this component -# if a component has a start script -# list the component as a subcomponent of itself -# HasFirmware => components which need HCA firmware update after installed -# -# Note both Components and SubComponents are included in the list below. -# Components require all fields be supplied -# SubComponents only require the following fields: -# Name, PreReq (should reference only components), HasStart, StartPreReq, -# DefaultStart -my %ComponentInfo_other = ( - # our special WrapperComponent, limited use - "opaconfig" => { Name => "opaconfig", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => "", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, - StartPreReq => "", - StartComponents => [ ], - }, - # "ofed" is only used for source_comp - "ofed_delta" => { Name => "OFA_DELTA", - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - }, - "opa_stack" => { Name => "OFA OPA Stack", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "updates", - PreReq => "", CoReq => " oftools ", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => "", - StartComponents => [ "opa_stack" ], - }, - "ibacm" => { Name => "OFA IBACM", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ "ibacm" ], - }, - "intel_hfi" => { Name => "Intel HFI Components", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => " oftools ", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "intel_hfi" ], - }, - "oftools" => { Name => "OPA Tools", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-Tools*.*"), - DriverSubdir => "", - PreReq => " opa_stack ibacm ", CoReq => " opa_stack ", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", # TBD - StartComponents => [ ], - }, - "mpi_selector" => { Name => "MPI selector", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 1, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opa_stack_dev" => { Name => "OFA OPA Development", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "fastfabric" => { Name => "FastFabric", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-Tools*.*"), - DriverSubdir => "", - PreReq => " opa_stack oftools ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ ], - }, - "delta_ipoib" => { Name => "OFA IP over IB", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "delta_ipoib" ], - }, - "mvapich2" => { Name => "MVAPICH2 (verbs,gcc)", - DefaultInstall => $State_DoNotInstall, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack mpi_selector intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi" => { Name => "OpenMPI (verbs,gcc)", - DefaultInstall => $State_DoNotInstall, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack mpi_selector intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "gasnet" => { Name => "GASNet (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openshmem" => { Name => "OpenSHMEM (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack gasnet intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mvapich2_gcc_hfi" => { Name => "MVAPICH2 (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mvapich2_intel_hfi" => { Name => "MVAPICH2 (hfi,Intel)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi_gcc_hfi" => { Name => "OpenMPI (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi_intel_hfi" => { Name => "OpenMPI (hfi,Intel)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "delta_mpisrc" =>{ Name => "MPI Source", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack opa_stack_dev mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opafm" => { Name => "OPA FM", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-FM.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - #StartComponents => [ "qlgc_fm", "qlgc_fm_snmp"], - StartComponents => [ "opafm" ], - }, - "opamgt_sdk" => { Name => "OPA Management SDK", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-Tools*.*"), - DriverSubdir => "", - Prereq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ ], - }, - "delta_debug" => { Name => "OFA Debug Info", - DefaultInstall => $State_DoNotInstall, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "hfi1_uefi" => { Name => "Pre-Boot Components", - DefaultInstall => $State_DoNotInstall, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "rdma_ndd" => { Name => "RDMA NDD", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 1, Disabled => 1, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ "rdma_ndd" ], - }, - ); -my %ComponentInfo_rhel72 = ( - # our special WrapperComponent, limited use - "opaconfig" => { Name => "opaconfig", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => "", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, - StartPreReq => "", - StartComponents => [ ], - }, - # "ofed" is only used for source_comp - "ofed_delta" => { Name => "OFA_DELTA", - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - }, - "opa_stack" => { Name => "OFA OPA Stack", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "extra/ifs-kernel-updates", - PreReq => "", CoReq => " oftools ", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => "", - StartComponents => [ "opa_stack" ], - }, - "ibacm" => { Name => "OFA IBACM", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ "ibacm" ], - }, - "intel_hfi" => { Name => "Intel HFI Components", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => " oftools ", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "intel_hfi" ], - }, - "oftools" => { Name => "OPA Tools", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-Tools*.*"), - DriverSubdir => "", - PreReq => " opa_stack ibacm ", CoReq => " opa_stack ", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", # TBD - StartComponents => [ ], - }, - "mpi_selector" => { Name => "MPI selector", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 1, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opa_stack_dev" => { Name => "OFA OPA Development", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "fastfabric" => { Name => "FastFabric", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-Tools*.*"), - DriverSubdir => "", - PreReq => " opa_stack oftools ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ ], - }, - "delta_ipoib" => { Name => "OFA IP over IB", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "delta_ipoib" ], - }, - "mvapich2" => { Name => "MVAPICH2 (verbs,gcc)", - DefaultInstall => $State_DoNotInstall, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack mpi_selector intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi" => { Name => "OpenMPI (verbs,gcc)", - DefaultInstall => $State_DoNotInstall, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack mpi_selector intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "gasnet" => { Name => "GASNet (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openshmem" => { Name => "OpenSHMEM (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack gasnet intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi_gcc_cuda_hfi" =>{ Name => "OpenMPI (cuda,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mvapich2_gcc_hfi" => { Name => "MVAPICH2 (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mvapich2_intel_hfi" => { Name => "MVAPICH2 (hfi,Intel)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi_gcc_hfi" => { Name => "OpenMPI (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi_intel_hfi" => { Name => "OpenMPI (hfi,Intel)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "delta_mpisrc" =>{ Name => "MPI Source", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack opa_stack_dev mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opafm" => { Name => "OPA FM", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-FM.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - #StartComponents => [ "qlgc_fm", "qlgc_fm_snmp"], - StartComponents => [ "opafm" ], - }, - "opamgt_sdk" => { Name => "OPA Management SDK", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-Tools*.*"), - DriverSubdir => "", - Prereq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ ], - }, - "delta_debug" => { Name => "OFA Debug Info", - DefaultInstall => $State_DoNotInstall, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "hfi1_uefi" => { Name => "Pre-Boot Components", - DefaultInstall => $State_DoNotInstall, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "rdma_ndd" => { Name => "RDMA NDD", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 1, Disabled => 1, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ "rdma_ndd" ], - }, - ); - -my %ComponentInfo_sles12_sp2 = ( - # our special WrapperComponent, limited use - "opaconfig" => { Name => "opaconfig", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => "", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, - StartPreReq => "", - StartComponents => [ ], - }, - # "ofed" is only used for source_comp - "ofed_delta" => { Name => "OFA_DELTA", - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - }, - "opa_stack" => { Name => "OFA OPA Stack", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "updates/ifs-kernel-updates", - PreReq => "", CoReq => " oftools ", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => "", - StartComponents => [ "opa_stack" ], - }, - "ibacm" => { Name => "OFA IBACM", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 1, Disabled => 1, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ "ibacm" ], - }, - "intel_hfi" => { Name => "Intel HFI Components", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => " oftools ", - # TBD - HasFirmware - FW update - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "intel_hfi" ], - }, - "oftools" => { Name => "OPA Tools", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-Tools*.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => " opa_stack ", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", # TBD - StartComponents => [ ], - }, - "mpi_selector" => { Name => "MPI selector", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 1, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opa_stack_dev" => { Name => "OFA OPA Development", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "fastfabric" => { Name => "FastFabric", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-Tools*.*"), - DriverSubdir => "", - PreReq => " opa_stack oftools ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ ], - }, - "delta_ipoib" => { Name => "OFA IP over IB", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "updates", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 1, - StartPreReq => " opa_stack ", - StartComponents => [ "delta_ipoib" ], - }, - "mvapich2" => { Name => "MVAPICH2 (verbs,gcc)", - DefaultInstall => $State_DoNotInstall, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack mpi_selector intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi" => { Name => "OpenMPI (verbs,gcc)", - DefaultInstall => $State_DoNotInstall, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack mpi_selector intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "gasnet" => { Name => "GASNet (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openshmem" => { Name => "OpenSHMEM (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack gasnet intel_hfi ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi_gcc_cuda_hfi" =>{ Name => "OpenMPI (cuda,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mvapich2_gcc_hfi" => { Name => "MVAPICH2 (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "mvapich2_intel_hfi" => { Name => "MVAPICH2 (hfi,Intel)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi_gcc_hfi" => { Name => "OpenMPI (hfi,gcc)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "openmpi_intel_hfi" => { Name => "OpenMPI (hfi,Intel)", - DefaultInstall => $State_Install, - SrcDir => file_glob ("./OFED_MPIS.*"), - DriverSubdir => "", - PreReq => " opa_stack intel_hfi mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "delta_mpisrc" =>{ Name => "MPI Source", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack opa_stack_dev mpi_selector ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opafm" => { Name => "OPA FM", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-FM.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - #StartComponents => [ "qlgc_fm", "qlgc_fm_snmp"], - StartComponents => [ "opafm" ], - }, - "opamgt_sdk" => { Name => "OPA Management SDK", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-Tools*.*"), - DriverSubdir => "", - Prereq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ ], - }, - "delta_debug" => { Name => "OFA Debug Info", - DefaultInstall => $State_DoNotInstall, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "hfi1_uefi" => { Name => "Pre-Boot Components", - DefaultInstall => $State_DoNotInstall, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "rdma_ndd" => { Name => "RDMA NDD", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 1, Disabled => 1, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ "rdma_ndd" ], - }, - ); -my %ComponentInfo_rhel73 = ( +@supported_kernels = ( $CUR_OS_VER ); # TBD how do we verify OS +my $Build_OsVer=$CUR_OS_VER; +my $Build_Debug=0; # should we provide more info for debug +my $Build_Temp=""; # temp area to use for build +my $Default_Build = 0; # -B option used to select build +my $Build_Force = 0;# rebuild option used to force full rebuild + +$FirstIPoIBInterface=0; # first device is ib0 + + # Names of supported install components + # must be listed in depdency order such that prereqs appear 1st + +my @OmniPathAllComponents = ( "mvapich2_gcc_hfi", + "mvapich2_intel_hfi", + "openmpi_gcc_hfi", + "openmpi_intel_hfi", + ); + +# these are now gone, list them so they get uninstalled +my @Components_other = ( "opa_stack", "ibacm", "mpi_selector", "intel_hfi", + "oftools", "opa_stack_dev", "fastfabric", "rdma_ndd", + "delta_ipoib", "opafm", "opamgt_sdk", + @OmniPathAllComponents, + "gasnet", "openshmem", "sandiashmem", + "mvapich2", "openmpi", + "delta_mpisrc", "hfi1_uefi", "delta_debug", ); +my @Components_rhel67 = ( "opa_stack", "ibacm", "mpi_selector", "intel_hfi", + "oftools", "opa_stack_dev", "fastfabric", "rdma_ndd", + "delta_ipoib", "opafm", "opamgt_sdk", + @OmniPathAllComponents, + "gasnet", "openshmem", + "mvapich2", "openmpi", + "delta_mpisrc", "hfi1_uefi", "delta_debug", ); +my @Components_rhel72 = ( "opa_stack", "ibacm", "mpi_selector", "intel_hfi", + "oftools", "opa_stack_dev", "fastfabric", "rdma_ndd", + "delta_ipoib", "opafm", "opamgt_sdk", + @OmniPathAllComponents, + "openmpi_gcc_cuda_hfi", "gasnet", "openshmem", "sandiashmem", + "mvapich2", "openmpi", + "delta_mpisrc", "hfi1_uefi", "delta_debug", ); +my @Components_sles12_sp2 = ( "opa_stack", "ibacm", "mpi_selector", "intel_hfi", + "oftools", "opa_stack_dev", "fastfabric", "rdma_ndd", + "delta_ipoib", "opafm", "opamgt_sdk", + @OmniPathAllComponents, + "openmpi_gcc_cuda_hfi", "gasnet", "openshmem", "sandiashmem", + "mvapich2", "openmpi", + "delta_mpisrc", "hfi1_uefi", "delta_debug", ); +my @Components_rhel73 = ( "opa_stack", "ibacm", "mpi_selector", "intel_hfi", + "oftools", "opa_stack_dev", "fastfabric", "rdma_ndd", + "delta_ipoib", "opafm", "opamgt_sdk", + @OmniPathAllComponents, + "openmpi_gcc_cuda_hfi", "gasnet", "openshmem", "sandiashmem", + "mvapich2", "openmpi", + "delta_mpisrc", "hfi1_uefi", "delta_debug", ); +my @Components_sles12_sp3 = ( "opa_stack", "ibacm", "mpi_selector", "intel_hfi", + "oftools", "opa_stack_dev", "fastfabric", "rdma_ndd", + "delta_ipoib", "opafm", "opamgt_sdk", + @OmniPathAllComponents, + "openmpi_gcc_cuda_hfi", "gasnet", "openshmem", "sandiashmem", + "mvapich2", "openmpi", + "delta_mpisrc", "hfi1_uefi", "delta_debug", ); +my @Components_rhel74 = ( "opa_stack", "ibacm", "mpi_selector", "intel_hfi", + "oftools", "opa_stack_dev", "fastfabric", "rdma_ndd", + "delta_ipoib", "opafm", "opamgt_sdk", + @OmniPathAllComponents, + "openmpi_gcc_cuda_hfi", "gasnet", "openshmem", "sandiashmem", + "mvapich2", "openmpi", + "delta_mpisrc", "hfi1_uefi", "delta_debug", ); +@Components = ( ); + +# delta_debug must be last + +@SubComponents = ( ); + + # an additional "special" component which is always installed when + # we install/upgrade anything and which is only uninstalled when everything + # else has been uninstalled. Typically this will be the opaconfig + # file and related files absolutely required by it (such as wrapper_version) +$WrapperComponent = "opaconfig"; + +# This provides more detailed information about each Component in @Components +# since hashes are not retained in the order specified, we still need +# @Components and @SubComponents to control install and menu order +# Only items listed in @Components and @SubComponents are considered for install +# As such, this may list some components which are N/A to the selected distro +# Fields are as follows: +# Name => full name of component/subcomponent for prompts +# DefaultInstall => default installation (State_DoNotInstall or State_Install) +# used only when available and ! installed +# SrcDir => directory name within install media for component +# DriverSubdir => directory within /lib/modules/$CUR_OS_VERSION/ to +# install driver to. Set to "" if no drivers in component +# set to "." if no subdir +# PreReq => other components which are prereqs of a given +# component/subcomponent +# Need space before and after each component name to +# facilitate compares so that compares do not mistake names +# such as mpidev for mpi +# CoReq => other components which are coreqs of a given component +# Note that CoReqs can also be listed as prereqs to provide +# install verification as each component is installed, +# however prereqs should only refer to items earlier in the list +# Need space before and after each component name to +# facilitate compares so that compares do not mistake names +# such as mpidev for mpi +# Hidden => component should not be shown in menus/prompts +# used for hidden PreReq. Hidden components can't HasStart +# nor HasFirmware +# Disabled => components/subcomponents which are disabled from installation +# HasStart => components/subcomponents which have autostart capability +# DefaultStart => should autostart default to Enable (1) or Disable (0) +# Not needed/ignored unless HasStart=1 +# StartPreReq => other components/subcomponents which must be autostarted +# before autostarting this component/subcomponent +# Not needed/ignored unless HasStart=1 +# Need space before and after each component name to +# facilitate compares so that compares do not mistake names +# such as mpidev for mpi +# StartComponents => components/subcomponents with start for this component +# if a component has a start script +# list the component as a subcomponent of itself +# HasFirmware => components which need HCA firmware update after installed +# +# Note both Components and SubComponents are included in the list below. +# Components require all fields be supplied +# SubComponents only require the following fields: +# Name, PreReq (should reference only components), HasStart, StartPreReq, +# DefaultStart +%ComponentInfo = ( # our special WrapperComponent, limited use "opaconfig" => { Name => "opaconfig", DefaultInstall => $State_Install, @@ -902,7 +185,7 @@ "opa_stack" => { Name => "OFA OPA Stack", DefaultInstall => $State_Install, SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "extra/ifs-kernel-updates", + # DriverSubdir varies per distro PreReq => "", CoReq => " oftools ", # TBD - HasFirmware - FW update Hidden => 0, Disabled => 0, @@ -910,16 +193,17 @@ StartPreReq => "", StartComponents => [ "opa_stack" ], }, - "ibacm" => { Name => "OFA IBACM", - DefaultInstall => $State_Install, - SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), - DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 1, Disabled => 1, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ "ibacm" ], - }, + # ibacm is used in rhel72 and other only + "ibacm" => { Name => "OFA IBACM", + DefaultInstall => $State_Install, + SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), + DriverSubdir => "", + PreReq => " opa_stack ", CoReq => "", + Hidden => 0, Disabled => 0, + HasStart => 1, HasFirmware => 0, DefaultStart => 0, + StartPreReq => " opa_stack ", + StartComponents => [ "ibacm" ], + }, "intel_hfi" => { Name => "Intel HFI Components", DefaultInstall => $State_Install, SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), @@ -1021,6 +305,16 @@ StartPreReq => "", StartComponents => [ ], }, + "sandiashmem" => { Name => "Sandia-OpenSHMEM ", + DefaultInstall => $State_Install, + SrcDir => file_glob("./IntelOPA-OFED_DELTA.*"), + DriverSubdir => "", + PreReq => " opa_stack intel_hfi ", CoReq => "", + Hidden => 0, Disabled => 0, + HasStart => 0, HasFirmware => 0, DefaultStart => 0, + StartPreReq => "", + StartComponents => [ ], + }, "openmpi_gcc_cuda_hfi" =>{ Name => "OpenMPI (cuda,gcc)", DefaultInstall => $State_Install, SrcDir => file_glob ("./OFED_MPIS.*"), @@ -1134,8 +428,6 @@ }, ); -%ComponentInfo = ( ); - # translate from startup script name to component/subcomponent name %StartupComponent = ( "opa_stack" => "opa_stack", @@ -1163,22 +455,47 @@ "hfi1_uefi" => 0, "delta_debug" => 0, "rdma_ndd" => 0, + "sandiashmem" => 0, ); sub init_components { + # The component list has slight variations per distro + # TBD - the DriverSubDir should be moved to a global per distro variable + # and ComponentInfo.DriverSubDir should be changed to a simple boolean + # to indicate if the given component has some drivers if ( "$CUR_VENDOR_VER" eq "ES72" ) { @Components = ( @Components_rhel72 ); - %ComponentInfo = ( %ComponentInfo_rhel72 ); + $ComponentInfo{'opa_stack'}{'DriverSubdir'} = "extra/ifs-kernel-updates"; + $ComponentInfo{'oftools'}{'PreReq'} = " opastack ibacm "; } elsif ( "$CUR_VENDOR_VER" eq "ES122" ) { @Components = ( @Components_sles12_sp2 ); - %ComponentInfo = ( %ComponentInfo_sles12_sp2 ); + $ComponentInfo{'opa_stack'}{'DriverSubdir'} = "updates/ifs-kernel-updates"; + $ComponentInfo{'ibacm'}{'Hidden'} = 1; + $ComponentInfo{'ibacm'}{'Disabled'} = 1; } elsif ( "$CUR_VENDOR_VER" eq "ES73" ) { @Components = ( @Components_rhel73 ); - %ComponentInfo = ( %ComponentInfo_rhel73 ); + $ComponentInfo{'opa_stack'}{'DriverSubdir'} = "extra/ifs-kernel-updates"; + $ComponentInfo{'ibacm'}{'Hidden'} = 1; + $ComponentInfo{'ibacm'}{'Disabled'} = 1; + } elsif ( "$CUR_VENDOR_VER" eq "ES123" ) { + @Components = ( @Components_sles12_sp3 ); + $ComponentInfo{'opa_stack'}{'DriverSubdir'} = "updates/ifs-kernel-updates"; + $ComponentInfo{'ibacm'}{'Hidden'} = 1; + $ComponentInfo{'ibacm'}{'Disabled'} = 1; + } elsif ( "$CUR_VENDOR_VER" eq "ES74" ) { + @Components = ( @Components_rhel74 ); + $ComponentInfo{'opa_stack'}{'DriverSubdir'} = "extra/ifs-kernel-updates"; + $ComponentInfo{'ibacm'}{'Hidden'} = 1; + $ComponentInfo{'ibacm'}{'Disabled'} = 1; + } elsif ( "$CUR_VENDOR_VER" eq "ES67" ) { + @Components = ( @Components_rhel67 ); + $ComponentInfo{'opa_stack'}{'DriverSubdir'} = "updates"; + $ComponentInfo{'oftools'}{'PreReq'} = " opastack ibacm "; } else { @Components = ( @Components_other ); - %ComponentInfo = ( %ComponentInfo_other ); + $ComponentInfo{'opa_stack'}{'DriverSubdir'} = "updates"; + $ComponentInfo{'oftools'}{'PreReq'} = " opastack ibacm "; } } @@ -1443,7 +760,7 @@ sub Usage printf STDERR " can appear with -D or more than once on command line\n"; printf STDERR " -D comp - disable autostart of given component\n"; printf STDERR " can appear with -E or more than once on command line\n"; - printf STDERR " -G - install GPU Direct components\n"; + printf STDERR " -G - install GPU Direct components(must have NVidia drivers installed)\n"; printf STDERR " -v - verbose logging\n"; printf STDERR " -vv - very verbose debug logging\n"; printf STDERR " -C - output list of supported components\n"; @@ -1495,7 +812,7 @@ sub translate_comp "openmpi_gcc_hfi", "mvapich2_intel_hfi", "openmpi_intel_hfi"); } elsif ("$arg" eq "verbs_mpi") { return ( "mvapich2", "openmpi" ); - } elsif ("$arg" eq "pgas") { return ( "gasnet", "openshmem" ); + } elsif ("$arg" eq "pgas") { return ( "gasnet", "openshmem", "sandiashmem" ); } elsif ("$arg" eq "mpisrc") { return ( "delta_mpisrc" ); # no ibaccess argument equivalent for: # openmpi, delta_debug @@ -1910,6 +1227,10 @@ sub show_menu determine_os_version; init_components; +# when this is used as main for a component specific INSTALL +# the component can provide some overrides of global settings such as Components +overrides; + process_args; check_root_user; if ( ! $Default_Build ) { @@ -1931,12 +1252,6 @@ sub show_menu } } -foreach my $comp ( @OmniPathAllComponents ) -{ - $ComponentInfo{$comp}{'DefaultInstall'} = $State_Install; - $Default_EnabledComponents{$comp} = 1; -} - set_libdir; init_delta_rpm_info($CUR_OS_VER); diff --git a/CommonInstall/main_openibff.pl b/CommonInstall/main_openibff.pl deleted file mode 100755 index ea85d0c7..00000000 --- a/CommonInstall/main_openibff.pl +++ /dev/null @@ -1,672 +0,0 @@ -#!/usr/bin/perl -# BEGIN_ICS_COPYRIGHT8 **************************************** -# -# Copyright (c) 2015, Intel Corporation -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# END_ICS_COPYRIGHT8 **************************************** - -# [ICS VERSION STRING: unknown] -use strict; -#use Term::ANSIColor; -#use Term::ANSIColor qw(:constants); -#use File::Basename; -#use Math::BigInt; - -# =========================================================================== -# Main menus, option handling and version handling for FF for OFED install -# - -$MainInstall="openibff"; - -my $FirstIPoIBInterface=0; # first device is ib0 - - # Names of supported install components - # must be listed in depdency order such that prereqs appear 1st -@Components = ( "oftools", "fastfabric", "opamgt_sdk" ); - -# Sub components for autostart processing -@SubComponents = ( ); - - # an additional "special" component which is always installed when - # we install/upgrade anything and which is only uninstalled when everything - # else has been uninstalled. Typically this will be the opaconfig - # file and related files absolutely required by it (such as wrapper_version) -$WrapperComponent = "opa_config_ff"; - -# This provides more detailed information about each Component in @Components -# since hashes are not retained in the order specified, we still need -# @Components and @SubComponents to control install and menu order -# Fields are as follows: -# Name => full name of component/subcomponent for prompts -# DefaultInstall => default installation (State_DoNotInstall or State_Install) -# used only when available and ! installed -# SrcDir => directory name within install media for component -# DriverSubdir => directory within /lib/modules/$CUR_OS_VERSION/ to -# install driver to. Set to "" if no drivers in component -# set to "." if no subdir -# PreReq => other components which are prereqs of a given -# component/subcomponent -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# CoReq => other components which are coreqs of a given component -# Note that CoReqs can also be listed as prereqs to provide -# install verification as each component is installed, -# however prereqs should only refer to items earlier in the list -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# Hidden => component should not be shown in menus/prompts -# used for hidden PreReq. Hidden components can't HasStart -# nor HasFirmware -# Disabled => components/subcomponents which are disabled from installation -# HasStart => components/subcomponents which have autostart capability -# DefaultStart => should autostart default to Enable (1) or Disable (0) -# Not needed/ignored unless HasStart=1 -# StartPreReq => other components/subcomponents which must be autostarted -# before autostarting this component/subcomponent -# Not needed/ignored unless HasStart=1 -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# StartComponents => components/subcomponents with start for this component -# if a component has a start script -# list the component as a subcomponent of itself -# HasFirmware => components which need HCA firmware update after installed -# -# Note both Components and SubComponents are included in the list below. -# Components require all fields be supplied -# SubComponents only require the following fields: -# Name, PreReq (should reference only components), HasStart, StartPreReq, -# DefaultStart -%ComponentInfo = ( - # our special WrapperComponent, limited use - "opa_config_ff" => { Name => "opa_config_ff", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => "", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "oftools" => { Name => "OPA Tools", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ ], - }, - "fastfabric" => { Name => "FastFabric", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack oftools ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ ], - }, - "opamgt_sdk" => { Name => "OPA Management SDK", - DefaultInstall => $State_Install, - SrcDir => ".", - DriverSubdir => "", - Prereq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ ], - }, - # ipoib is not on media, just for a few prompts - "ipoib" => { Name => "IP over IB", - }, - ); - # translate from startup script name to component/subcomponent name -%StartupComponent = ( ); - # has component been loaded since last configured autostart -%ComponentWasInstalled = ( - "oftools" => 0, - "fastfabric" => 0, - "opamgt_sdk" => 0, - ); - -# ========================================================================== -# opa_config_ff installation -# This is a special WrapperComponent which only needs: -# available, install and uninstall -# it cannot have startup scripts, dependencies, prereqs, etc - -sub available_opa_config_ff -{ - my $srcdir=$ComponentInfo{'opa_config_ff'}{'SrcDir'}; - return ( -e "$srcdir/INSTALL" ); -} - -sub install_opa_config_ff -{ - my $install_list = $_[0]; # total that will be installed when done - my $installing_list = $_[1]; # what items are being installed/reinstalled - - my $srcdir=$ComponentInfo{'opa_config_ff'}{'SrcDir'}; - NormalPrint("Installing $ComponentInfo{'opa_config_ff'}{'Name'}...\n"); - - check_config_dirs(); - copy_systool_file("$srcdir/INSTALL", "/sbin/opa_config_ff"); - # no need for a version file, fastfabric will have its own - - # if IntelOPA-Basic/IntelOPA-IFS is not installed, create opaconfig too - if ( ! -e "$BASE_DIR/version_wrapper" ) { - copy_systool_file("$srcdir/INSTALL", "/sbin/opaconfig"); - } - - $ComponentWasInstalled{'opa_config_ff'}=1; -} - -sub uninstall_opa_config_ff -{ - my $install_list = $_[0]; # total that will be left installed when done - my $uninstalling_list = $_[1]; # what items are being uninstalled - - NormalPrint("Uninstalling $ComponentInfo{'opa_config_ff'}{'Name'}...\n"); - system("rm -rf $ROOT/sbin/opa_config_ff"); - # if IntelOPA-Basic/IntelOPA-IFS is not installed, remove opaconfig too - if ( ! -e "$BASE_DIR/version_wrapper" ) { - system("rm -rf $ROOT/sbin/opaconfig"); - } - $ComponentWasInstalled{'opa_config_ff'}=0; -} - -my $allow_install; -if ( my_basename($0) ne "INSTALL" ) -{ - if ( my_basename($0) eq "ics_ib" ) - { - printf("Warning: ics_ib is depricated, use opaconfig\n"); - HitKeyCont; - } - $allow_install=0; -} else { - $allow_install=1; - $FabricSetupScpFromDir=".."; -} - -# -# Check if all basic requirements are ok -# -sub verify_os_ver -{ - determine_os_version; - #my $supported_kernel; - # - #if (!$allow_install) - #{ - # my $catkernels = `cat $ROOT$BASE_DIR/supported_kernels`; - # @supported_kernels = split( / +/, $catkernels); - #} else { - # system("echo -n @supported_kernels > ./config/supported_kernels"); - #} - # - #foreach my $supported_kernel_path ( @supported_kernels ) - #{ - # $supported_kernel = my_basename($supported_kernel_path); - # - # $module_dirs[++$#module_dirs] = "/lib/modules/$supported_kernel"; - #} -} - -sub Usage -{ - if ( $allow_install ) { - #printf STDERR "Usage: $0 [-r root] [-v|-vv] [-a|-n|-U|-F|-u|-s|-i comp|-e comp] [-E comp] [-D comp] [-f] [--fwupdate asneeded|always] [-l] [--without-depcheck] [--force] [--answer keyword=value]\n"; -# printf STDERR "Usage: $0 [-r root] [-v|-vv] [-a|-n|-U|-F|-u|-s|-i comp|-e comp] [-E comp] [-D comp] [-f] [--fwupdate asneeded|always] [--without-depcheck] [--force] [--answer keyword=value]\n"; - printf STDERR "Usage: $0 [-r root] [-v|-vv] [-a|-n|-U|-u|-s|-O|-N|-i comp|-e comp] [-E comp] [-D comp] [--without-depcheck] [--force] [--answer keyword=value]\n"; - } else { -# printf STDERR "Usage: $0 [-r root] [-v|-vv] [-F|-u|-s|-e comp] [-E comp] [-D comp][--fwupdate asneeded|always] [--answer keyword=value]\n"; - printf STDERR "Usage: $0 [-r root] [-v|-vv] [-u|-s|-e comp] [-E comp] [-D comp] [--answer keyword=value]\n"; - } - printf STDERR " or\n"; - printf STDERR "Usage: $0 -C\n"; - printf STDERR " or\n"; - printf STDERR "Usage: $0 -V\n"; - if ( $allow_install ) { - printf STDERR " -a - install all ULPs and drivers with default options\n"; - printf STDERR " -n - install all ULPs and drivers with default options\n"; - printf STDERR " but with no change to autostart options\n"; - printf STDERR " -U - upgrade/re-install all presently installed ULPs and drivers with\n"; - printf STDERR " default options and no change to autostart options\n"; - printf STDERR " -i comp - install the given component with default options\n"; - printf STDERR " can appear more than once on command line\n"; -# printf STDERR " -f - skip HCA firmware upgrade during install\n"; - #printf STDERR " -l - skip creating/removing symlinks to /usr/local from /usr/lib/opa\n"; - printf STDERR " --without-depcheck - disable check of OS dependencies\n"; - printf STDERR " --force - force install even if distos don't match\n"; - printf STDERR " Use of this option can result in undefined behaviors\n"; - printf STDERR " -O - Keep current modified rpm config file\n"; - printf STDERR " -N - Use new default rpm config file\n"; - } -# printf STDERR " -F - upgrade HCA Firmware with default options\n"; -# printf STDERR " --fwupdate asneeded|always - select fw update auto update mode\n"; -# printf STDERR " asneeded - update or downgrade to match version in this release\n"; -# printf STDERR " always - rewrite with this releases version even if matches\n"; -# printf STDERR " default is to upgrade as needed but not downgrade\n"; -# printf STDERR " this option is ignored for interactive install\n"; - printf STDERR " -u - uninstall all ULPs and drivers with default options\n"; - printf STDERR " -s - enable autostart for all installed drivers\n"; - printf STDERR " -r - specify alternate root directory, default is /\n"; - printf STDERR " -e comp - uninstall the given component with default options\n"; - printf STDERR " can appear more than once on command line\n"; - printf STDERR " -E comp - enable autostart of given component\n"; - printf STDERR " can appear with -D or more than once on command line\n"; - printf STDERR " -D comp - disable autostart of given component\n"; - printf STDERR " can appear with -E or more than once on command line\n"; - printf STDERR " -v - verbose logging\n"; - printf STDERR " -vv - very verbose debug logging\n"; - printf STDERR " -C - output list of supported components\n"; - printf STDERR " -V - output Version\n"; - showAnswerHelp(); - printf STDERR " default options retain existing configuration files\n"; - printf STDERR " supported component names:\n"; - printf STDERR " "; - foreach my $comp ( @Components ) - { - printf STDERR " $comp"; - } - printf STDERR "\n"; - if (scalar(@SubComponents) > 0) { - printf STDERR " additional component names allowed for -E and -D options:\n"; - printf STDERR " "; - foreach my $comp ( @SubComponents ) - { - printf STDERR " $comp"; - } - printf STDERR "\n"; - } - exit (2); -} - -my $Default_FirmwareUpgrade=0; # -F option used to select default firmware upgrade - -sub process_args -{ - my $arg; - my $last_arg; - my $setroot = 0; - my $setanswer = 0; - my $install_opt = 0; - my $setcomp = 0; - my $setenabled = 0; - my $setdisabled = 0; - my $setfwmode = 0; - my $comp = 0; - - if (scalar @ARGV >= 1) { - foreach $arg (@ARGV) { - if ( $setroot ) { - $ROOT="$arg"; - if (substr($ROOT,0,1) ne "/") { - printf STDERR "Invalid -r root (must be absolute path): '$ROOT'\n"; - Usage; - } - if (! -d $ROOT) { - printf STDERR "Invalid -r root (directory not found): '$ROOT'\n"; - Usage; - } - $setroot=0; - } elsif ( $setanswer ) { - my @pair = split /=/,$arg; - if ( scalar(@pair) != 2 ) { - printf STDERR "Invalid --answer keyword=value: '$arg'\n"; - Usage; - } - set_answer($pair[0], $pair[1]); - $setanswer=0; - } elsif ( $setcomp ) { - foreach $comp ( @Components ) - { - if ( "$arg" eq "$comp" ) - { - $Default_Components{$arg} = 1; - $setcomp=0; - } - } - if ( $setcomp ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( $setenabled ) { - foreach $comp ( @Components, @SubComponents ) - { - if ( "$arg" eq "$comp" ) - { - $Default_EnabledComponents{$arg} = 1; - $setenabled=0; - } - } - if ( $setenabled ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( $setdisabled ) { - foreach $comp ( @Components, @SubComponents ) - { - if ( "$arg" eq "$comp" ) - { - $Default_DisabledComponents{$arg} = 1; - $setdisabled=0; - } - } - if ( $setdisabled ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } -# } elsif ( $setfwmode ) { -# if ( "$arg" eq "always" || "$arg" eq "asneeded") { -# $Default_FirmwareUpgradeMode="$arg"; -# } else { -# printf STDERR "Invalid --fwupdate mode: $arg\n"; -# Usage; -# } -# $setfwmode = 0; - } elsif ( "$arg" eq "-r" ) { - $setroot=1; - } elsif ( "$arg" eq "-v" ) { - $LogLevel=1; - } elsif ( "$arg" eq "-vv" ) { - $LogLevel=2; -# } elsif ( "$arg" eq "-f" ) { -# $Skip_FirmwareUpgrade=1; -# } elsif ( "$arg" eq "--fwupdate" ) { -# $setfwmode=1; - } elsif ( "$arg" eq "--answer" ) { - $setanswer=1; - } elsif ( "$arg" eq "-i" ) { - $Default_CompInstall=1; - $Default_Prompt=1; - $setcomp=1; - if ($install_opt || $Default_CompUninstall) { - # can't mix -i with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-e" ) { - $Default_CompUninstall=1; - $Default_Prompt=1; - $setcomp=1; - if ($install_opt || $Default_CompInstall) { - # can't mix -e with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-E" ) { - $Default_Autostart=1; - $Default_EnableAutostart=1; - $Default_Prompt=1; - $setenabled=1; - } elsif ( "$arg" eq "-D" ) { - $Default_Autostart=1; - $Default_DisableAutostart=1; - $Default_Prompt=1; - $setdisabled=1; - } elsif ( "$arg" eq "--without-depcheck" ) { - $rpm_check_dependencies=0; - } elsif ( "$arg" eq "--force" ) { - $Force_Install=1; - } elsif ( "$arg" eq "-C" ) { - ShowComponents; - exit(0); - } elsif ( "$arg" eq "-V" ) { - printf "$VERSION\n"; - exit(0); - } else { - # Install options - if ( "$arg" eq "-a" ) { - $Default_Install=1; - } elsif ( "$arg" eq "-u" ) { - $Default_Uninstall=1; - } elsif ( "$arg" eq "-s" ) { - $Default_Autostart=1; - } elsif ( "$arg" eq "-n" ) { - $Default_Install=1; - $Default_SameAutostart=1; - } elsif ( "$arg" eq "-U" ) { - $Default_Upgrade=1; - $Default_SameAutostart=1; -# } elsif ( "$arg" eq "-F" ) { -# $Default_FirmwareUpgrade=1; - } elsif ("$arg" eq "-O") { - $Default_RpmConfigKeepOld=1; - $Default_RpmConfigUseNew=0; - } elsif ("$arg" eq "-N") { - $Default_RpmConfigKeepOld=0; - $Default_RpmConfigUseNew=1; - } else { - printf STDERR "Invalid option: $arg\n"; - Usage; - } - if ($install_opt || $Default_CompInstall - || $Default_CompUninstall) { - # only one of the above install selections - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - $install_opt=1; - $Default_Prompt=1; - } - $last_arg=$arg; - } - } - if ( $setroot || $setcomp || $setenabled || $setdisabled || $setfwmode || $setanswer) { - printf STDERR "Missing argument for option: $last_arg\n"; - Usage; - } - if ( ($Default_Install || $Default_CompInstall || $Default_Upgrade - || $Force_Install) - && ! $allow_install) { - printf STDERR "Installation options not permitted in this mode\n"; - Usage; - } -} - -my @INSTALL_CHOICES= (); -sub show_menu -{ - my $inp; - my $max_inp; - - @INSTALL_CHOICES= (); - if ( $Default_Install ) { - NormalPrint ("Installing All OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ( $Default_CompInstall ) { - NormalPrint ("Installing Selected OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ( $Default_Upgrade ) { - NormalPrint ("Upgrading/Re-Installing OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } -# if ( $Default_FirmwareUpgrade ) { -# NormalPrint ("Upgrading HCA Firmware\n"); -# @INSTALL_CHOICES = ( @INSTALL_CHOICES, 4); -# } - if ($Default_Uninstall ) { - NormalPrint ("Uninstalling All OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 6); - } - if ($Default_CompUninstall ) { - NormalPrint ("Uninstalling Selected OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 6); - } - if ($Default_Autostart) { - NormalPrint ("Configuring autostart for Selected installed OPA Drivers\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 3); - } - if (scalar(@INSTALL_CHOICES) > 0) { - return; - } -START: - system "clear"; - printf ("$BRAND OPA $VERSION Software\n\n"); - if ($allow_install) { - printf (" 1) Install/Uninstall Software\n"); - } else { - printf (" 1) Show Installed Software\n"); - } - printf (" 2) Reconfigure $ComponentInfo{'ipoib'}{'Name'}\n"); - printf (" 3) Reconfigure Driver Autostart \n"); - printf (" 4) Generate Supporting Information for Problem Report\n"); - printf (" 5) FastFabric (Host/Chassis/Switch Setup/Admin)\n"); -# printf (" 6) Update HCA Firmware\n"); - $max_inp=5; - if (!$allow_install) - { -# printf (" 7) Uninstall Software\n"); - printf (" 6) Uninstall Software\n"); - $max_inp=6; - } - printf ("\n X) Exit\n"); - - - $inp = getch(); - - if ($inp =~ /[qQ]/ || $inp =~ /[Xx]/ ) { - @INSTALL_CHOICES = ( 99999 ); # indicates exit, none selected - return; - } - if (ord($inp) == $KEY_ENTER) { - goto START; - } - - if ($inp =~ /[0123456789abcdefABCDEF]/) - { - $inp = hex($inp); - } - - if ($inp < 1 || $inp > $max_inp) - { -# printf ("Invalid choice...Try again\n"); - goto START; - } - @INSTALL_CHOICES = ( $inp ); -} - -process_args; -check_root_user; -open_log(""); -verify_os_ver; -verify_modtools; -set_libdir; -if ($allow_install) { - verify_distrib_files; -} - -RESTART: -show_menu; - -foreach my $INSTALL_CHOICE ( @INSTALL_CHOICES ) -{ - if ($allow_install && $INSTALL_CHOICE == 1) - { - select_debug_release("."); - show_install_menu(1); - if (! $Default_Prompt) { - goto RESTART; - } else { - if ($exit_code == 0) { - print "Done Installing OPA Software.\n" - } else { - print "Failed to install all OPA software.\n" - } - } - } - elsif ($INSTALL_CHOICE == 1) { - show_installed(1); - goto RESTART; - } - elsif ($INSTALL_CHOICE == 6) - { - show_uninstall_menu(1); - if (! $Default_Prompt ) { - goto RESTART; - } else { - if ($exit_code == 0) { - print "Done Uninstalling OPA Software.\n" - } else { - print "Failed to uninstall all OPA Software.\n" - } - } - } - elsif ($INSTALL_CHOICE == 2) - { - Config_ifcfg(1,"$ComponentInfo{'ipoib'}{'Name'}","ib", "$FirstIPoIBInterface",1); - check_network_config; - #Config_IPoIB_cfg; - goto RESTART; - } - elsif ($INSTALL_CHOICE == 3) - { - reconfig_autostart; - if (! $Default_Prompt ) { - goto RESTART; - } else { - print "Done OPA Driver Autostart Configuration.\n" - } - } -# elsif ($INSTALL_CHOICE == 4) -# { -# # Update HCA Firmware -# update_hca_firmware; -# if (! $Default_Prompt ) { -# goto RESTART; -# } else { -# print "Done HCA Firmware Update.\n" -# } -# } - elsif ($INSTALL_CHOICE == 4) - { - # Generate Supporting Information for Problem Report - capture_report($ComponentInfo{'oftools'}{'Name'}); - goto RESTART; - } - elsif ($INSTALL_CHOICE == 5) - { - # FastFabric (Host/Chassis/Switch Setup/Admin) - if ( "$ROOT" eq "" || "$ROOT" eq "/" ) { - run_fastfabric($ComponentInfo{'fastfabric'}{'Name'}); - } else { - print "Unable to run fastfabric when using an alternate root (-r)\n"; - HitKeyCont; - } - goto RESTART; - } -} -close_log; -exit $exit_code; diff --git a/CommonInstall/main_qlgc_fm.pl b/CommonInstall/main_qlgc_fm.pl deleted file mode 100644 index f9793a08..00000000 --- a/CommonInstall/main_qlgc_fm.pl +++ /dev/null @@ -1,560 +0,0 @@ -#!/usr/bin/perl -# BEGIN_ICS_COPYRIGHT8 **************************************** -# -# Copyright (c) 2015, Intel Corporation -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# END_ICS_COPYRIGHT8 **************************************** - -# [ICS VERSION STRING: unknown] -use strict; -#use Term::ANSIColor; -#use Term::ANSIColor qw(:constants); -#use File::Basename; -#use Math::BigInt; - -# =========================================================================== -# Main menus, option handling and version handling for FF for OFED install -# - -$MainInstall="opafm"; - - # Names of supported install components - # must be listed in depdency order such that prereqs appear 1st -@Components = ( "opafm" ); - - # an additional "special" component which is always installed when - # we install/upgrade anything and which is only uninstalled when everything - # else has been uninstalled. Typically this will be the opaconfig - # file and related files absolutely required by it (such as wrapper_version) -$WrapperComponent = "opa_config_fm"; - -# This provides more detailed information about each Component in @Components -# since hashes are not retained in the order specified, we still need -# @Components and @SubComponents to control install and menu order -# Fields are as follows: -# Name => full name of component/subcomponent for prompts -# DefaultInstall => default installation (State_DoNotInstall or State_Install) -# used only when available and ! installed -# SrcDir => directory name within install media for component -# DriverSubdir => directory within /lib/modules/$CUR_OS_VERSION/ to -# install driver to. Set to "" if no drivers in component -# set to "." if no subdir -# PreReq => other components which are prereqs of a given -# component/subcomponent -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# CoReq => other components which are coreqs of a given component -# Note that CoReqs can also be listed as prereqs to provide -# install verification as each component is installed, -# however prereqs should only refer to items earlier in the list -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# Hidden => component should not be shown in menus/prompts -# used for hidden PreReq. Hidden components can't HasStart -# nor HasFirmware -# Disabled => components/subcomponents which are disabled from installation -# HasStart => components/subcomponents which have autostart capability -# DefaultStart => should autostart default to Enable (1) or Disable (0) -# Not needed/ignored unless HasStart=1 -# StartPreReq => other components/subcomponents which must be autostarted -# before autostarting this component/subcomponent -# Not needed/ignored unless HasStart=1 -# Need space before and after each component name to -# facilitate compares so that compares do not mistake names -# such as mpidev for mpi -# StartComponents => components/subcomponents with start for this component -# if a component has a start script -# list the component as a subcomponent of itself -# HasFirmware => components which need HCA firmware update after installed -# -# Note both Components and SubComponents are included in the list below. -# Components require all fields be supplied -# SubComponents only require the following fields: -# Name, PreReq (should reference only components), HasStart, StartPreReq, -# DefaultStart -%ComponentInfo = ( - "opa_config_fm" => { Name => "opa_config_fm", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => "", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 0, HasFirmware => 0, DefaultStart => 0, - StartPreReq => "", - StartComponents => [ ], - }, - "opafm" => { Name => "OPA FM", - DefaultInstall => $State_Install, - SrcDir => ".", DriverSubdir => "", - PreReq => " opa_stack ", CoReq => "", - Hidden => 0, Disabled => 0, - HasStart => 1, HasFirmware => 0, DefaultStart => 0, - StartPreReq => " opa_stack ", - StartComponents => [ "opafm" ], - }, - ); - # translate from startup script name to component/subcomponent name -%StartupComponent = ( - "opafm" => "opafm", - ); - # has component been loaded since last configured autostart -%ComponentWasInstalled = ( - "opafm" => 0, - ); - -# ========================================================================== -# opa_config_fm installation -# This is a special WrapperComponent which only needs: -# available, install and uninstall -# it cannot have startup scripts, dependencies, prereqs, etc - -sub available_opa_config_fm -{ - my $srcdir=$ComponentInfo{'opa_config_fm'}{'SrcDir'}; - return ( -e "$srcdir/INSTALL" ); -} - -sub install_opa_config_fm -{ - my $install_list = $_[0]; # total that will be installed when done - my $installing_list = $_[1]; # what items are being installed/reinstalled - - my $srcdir=$ComponentInfo{'opa_config_fm'}{'SrcDir'}; - NormalPrint("Installing $ComponentInfo{'opa_config_fm'}{'Name'}...\n"); - - copy_systool_file("$srcdir/INSTALL", "/sbin/opa_config_fm"); - # no need for a version file, opafm will have its own - - $ComponentWasInstalled{'opa_config_fm'}=1; -} - -sub uninstall_opa_config_fm -{ - my $install_list = $_[0]; # total that will be left installed when done - my $uninstalling_list = $_[1]; # what items are being uninstalled - - NormalPrint("Uninstalling $ComponentInfo{'opa_config_fm'}{'Name'}...\n"); - system("rm -rf $ROOT/sbin/opa_config_fm"); - $ComponentWasInstalled{'opa_config_fm'}=0; -} - -my $allow_install; -if ( my_basename($0) ne "INSTALL" ) -{ - $allow_install=0; -} else { - $allow_install=1; -} - -# -# Check if all basic requirements are ok -# -sub verify_os_ver -{ - determine_os_version; - #my $supported_kernel; - # - #if (!$allow_install) - #{ - # my $catkernels = `cat $ROOT$BASE_DIR/supported_kernels`; - # @supported_kernels = split( / +/, $catkernels); - #} else { - # system("echo -n @supported_kernels > ./config/supported_kernels"); - #} - # - #foreach my $supported_kernel_path ( @supported_kernels ) - #{ - # $supported_kernel = my_basename($supported_kernel_path); - # - # $module_dirs[++$#module_dirs] = "/lib/modules/$supported_kernel"; - #} -} - -sub Usage -{ - if ( $allow_install ) { - #printf STDERR "Usage: $0 [-r root] [-v|-vv] [-a|-n|-U|-u|-s|-i comp|-e comp] [-E comp] [-D comp] [--without-depcheck] [--force] [--answer keyword=value]\n"; - # don't document -i and -e (-a and -u should be equivalent) - printf STDERR "Usage: $0 [-r root] [-v|-vv] [-a|-n|-U|-u|-s|-O|-N] [-E comp] [-D comp] [--without-depcheck] [--force] [--answer keyword=value]\n"; - } else { - #printf STDERR "Usage: $0 [-r root] [-v|-vv] [-u|-s|-e comp] [-E comp] [-D comp] [--answer keyword=value]\n"; - printf STDERR "Usage: $0 [-r root] [-v|-vv] [-u|-s] [-E comp] [-D comp] [--answer keyword=value]\n"; - } - printf STDERR " or\n"; - printf STDERR "Usage: $0 -C\n"; - printf STDERR " or\n"; - printf STDERR "Usage: $0 -V\n"; - if ( $allow_install ) { - printf STDERR " -a - install all ULPs and drivers with default options\n"; - printf STDERR " -n - install all ULPs and drivers with default options\n"; - printf STDERR " but with no change to autostart options\n"; - printf STDERR " -U - upgrade/re-install all presently installed ULPs and drivers with\n"; - printf STDERR " default options and no change to autostart options\n"; - #printf STDERR " -i comp - install the given component with default options\n"; - #printf STDERR " can appear more than once on command line\n"; - printf STDERR " --without-depcheck - disable check of OS dependencies\n"; - printf STDERR " --force - force install even if distos don't match\n"; - printf STDERR " Use of this option can result in undefined behaviors\n"; - printf STDERR " -O - Keep current modified rpm config file\n"; - printf STDERR " -N - Use new default rpm config file\n"; - } - printf STDERR " -u - uninstall all ULPs and drivers with default options\n"; - printf STDERR " -s - enable autostart for all installed drivers\n"; - printf STDERR " -r - specify alternate root directory, default is /\n"; - #printf STDERR " -e comp - uninstall the given component with default options\n"; - #printf STDERR " can appear more than once on command line\n"; - printf STDERR " -E comp - enable autostart of given component\n"; - printf STDERR " can appear with -D or more than once on command line\n"; - printf STDERR " -D comp - disable autostart of given component\n"; - printf STDERR " can appear with -E or more than once on command line\n"; - printf STDERR " -v - verbose logging\n"; - printf STDERR " -vv - very verbose debug logging\n"; - printf STDERR " -C - output list of supported components\n"; - printf STDERR " -V - output Version\n"; - showAnswerHelp(); - printf STDERR " default options retain existing configuration files\n"; - printf STDERR " supported component names:\n"; - printf STDERR " "; - foreach my $comp ( @Components ) - { - printf STDERR " $comp"; - } - printf STDERR "\n"; - if (scalar(@SubComponents) > 0) { - printf STDERR " additional component names allowed for -E and -D options:\n"; - printf STDERR " "; - foreach my $comp ( @SubComponents ) - { - printf STDERR " $comp"; - } - printf STDERR "\n"; - } - exit (2); -} - -sub process_args -{ - my $arg; - my $last_arg; - my $setroot = 0; - my $setanswer = 0; - my $install_opt = 0; - my $setcomp = 0; - my $setenabled = 0; - my $setdisabled = 0; - my $comp = 0; - - if (scalar @ARGV >= 1) { - foreach $arg (@ARGV) { - if ( $setroot ) { - $ROOT="$arg"; - if (substr($ROOT,0,1) ne "/") { - printf STDERR "Invalid -r root (must be absolute path): '$ROOT'\n"; - Usage; - } - if (! -d $ROOT) { - printf STDERR "Invalid -r root (directory not found): '$ROOT'\n"; - Usage; - } - $setroot=0; - } elsif ( $setanswer ) { - my @pair = split /=/,$arg; - if ( scalar(@pair) != 2 ) { - printf STDERR "Invalid --answer keyword=value: '$arg'\n"; - Usage; - } - set_answer($pair[0], $pair[1]); - $setanswer=0; - } elsif ( $setcomp ) { - foreach $comp ( @Components ) - { - if ( "$arg" eq "$comp" ) - { - $Default_Components{$arg} = 1; - $setcomp=0; - } - } - if ( $setcomp ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( $setenabled ) { - foreach $comp ( @Components, @SubComponents ) - { - if ( "$arg" eq "$comp" ) - { - $Default_EnabledComponents{$arg} = 1; - $setenabled=0; - } - } - if ( $setenabled ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( $setdisabled ) { - foreach $comp ( @Components, @SubComponents ) - { - if ( "$arg" eq "$comp" ) - { - $Default_DisabledComponents{$arg} = 1; - $setdisabled=0; - } - } - if ( $setdisabled ) - { - printf STDERR "Invalid component: $arg\n"; - Usage; - } - } elsif ( "$arg" eq "-r" ) { - $setroot=1; - } elsif ( "$arg" eq "-v" ) { - $LogLevel=1; - } elsif ( "$arg" eq "-vv" ) { - $LogLevel=2; - } elsif ( "$arg" eq "--answer" ) { - $setanswer=1; - } elsif ( "$arg" eq "-i" ) { - $Default_CompInstall=1; - $Default_Prompt=1; - $setcomp=1; - if ($install_opt || $Default_CompUninstall) { - # can't mix -i with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-e" ) { - $Default_CompUninstall=1; - $Default_Prompt=1; - $setcomp=1; - if ($install_opt || $Default_CompInstall) { - # can't mix -e with other install controls - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - } elsif ( "$arg" eq "-E" ) { - $Default_Autostart=1; - $Default_EnableAutostart=1; - $Default_Prompt=1; - $setenabled=1; - } elsif ( "$arg" eq "-D" ) { - $Default_Autostart=1; - $Default_DisableAutostart=1; - $Default_Prompt=1; - $setdisabled=1; - } elsif ( "$arg" eq "--without-depcheck" ) { - $rpm_check_dependencies=0; - } elsif ( "$arg" eq "--force" ) { - $Force_Install=1; - } elsif ( "$arg" eq "-C" ) { - ShowComponents; - exit(0); - } elsif ( "$arg" eq "-V" ) { - printf "$VERSION\n"; - exit(0); - } else { - # Install options - if ( "$arg" eq "-a" ) { - $Default_Install=1; - } elsif ( "$arg" eq "-u" ) { - $Default_Uninstall=1; - } elsif ( "$arg" eq "-s" ) { - $Default_Autostart=1; - } elsif ( "$arg" eq "-n" ) { - $Default_Install=1; - $Default_SameAutostart=1; - } elsif ( "$arg" eq "-U" ) { - $Default_Upgrade=1; - $Default_SameAutostart=1; - } elsif ("$arg" eq "-O") { - $Default_RpmConfigKeepOld=1; - $Default_RpmConfigUseNew=0; - } elsif ("$arg" eq "-N") { - $Default_RpmConfigKeepOld=0; - $Default_RpmConfigUseNew=1; - } else { - printf STDERR "Invalid option: $arg\n"; - Usage; - } - if ($install_opt || $Default_CompInstall - || $Default_CompUninstall) { - # only one of the above install selections - printf STDERR "Invalid combination of options: $arg not permitted with previous options\n"; - Usage; - } - $install_opt=1; - $Default_Prompt=1; - } - $last_arg=$arg; - } - } - if ( $setroot || $setcomp || $setenabled || $setdisabled || $setanswer) { - printf STDERR "Missing argument for option: $last_arg\n"; - Usage; - } - if ( ($Default_Install || $Default_CompInstall || $Default_Upgrade - || $Force_Install) - && ! $allow_install) { - printf STDERR "Installation options not permitted in this mode\n"; - Usage; - } -} - -my @INSTALL_CHOICES = (); -sub show_menu -{ - my $inp; - my $max_inp; - - @INSTALL_CHOICES = (); - if ( $Default_Install ) { - NormalPrint ("Installing All OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ( $Default_CompInstall ) { - NormalPrint ("Installing Selected OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ( $Default_Upgrade ) { - NormalPrint ("Upgrading/Re-Installing OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 1); - } - if ($Default_Uninstall ) { - NormalPrint ("Uninstalling All OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 3); - } - if ($Default_CompUninstall ) { - NormalPrint ("Uninstalling Selected OPA Software\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 3); - } - if ($Default_Autostart) { - NormalPrint ("Configuring autostart for Selected installed OPA Drivers\n"); - @INSTALL_CHOICES = ( @INSTALL_CHOICES, 2); - } - if (scalar(@INSTALL_CHOICES) > 0) { - return; - } -START: - system "clear"; - printf ("$BRAND OPA $VERSION Software\n\n"); - if ($allow_install) { - printf (" 1) Install/Uninstall Software\n"); - } else { - printf (" 1) Show Installed Software\n"); - } - printf (" 2) Reconfigure Driver Autostart \n"); - $max_inp=2; - if (!$allow_install) - { - printf (" 3) Uninstall Software\n"); - $max_inp=3; - } - printf ("\n X) Exit\n"); - - - $inp = getch(); - - if ($inp =~ /[qQ]/ || $inp =~ /[Xx]/ ) { - @INSTALL_CHOICES = ( 99999 ); # indicates exit, none selected - return; - } - if (ord($inp) == $KEY_ENTER) { - goto START; - } - - if ($inp =~ /[0123456789abcdefABCDEF]/) - { - $inp = hex($inp); - } - - if ($inp < 1 || $inp > $max_inp) - { -# printf ("Invalid choice...Try again\n"); - goto START; - } - @INSTALL_CHOICES = ( $inp ); -} - -process_args; -check_root_user; -open_log(""); -verify_os_ver; -verify_modtools; -set_libdir; -if ($allow_install) { - verify_distrib_files; -} - -RESTART: -show_menu; - -foreach my $INSTALL_CHOICE ( @INSTALL_CHOICES ) -{ - if ($allow_install && $INSTALL_CHOICE == 1) - { - select_debug_release("."); - show_install_menu(1); - if (! $Default_Prompt) { - goto RESTART; - } else { - if ($exit_code == 0) { - print "Done Installing OPA Software.\n" - } else { - print "Failed to install all OPA software.\n" - } - } - } - elsif ($INSTALL_CHOICE == 1) { - show_installed(1); - goto RESTART; - } - elsif ($INSTALL_CHOICE == 3) - { - show_uninstall_menu(1); - if (! $Default_Prompt ) { - goto RESTART; - } else { - if ($exit_code == 0) { - print "Done Uninstalling OPA Software.\n" - } else { - print "Failed to uninstall all OPA Software.\n" - } - } - } - elsif ($INSTALL_CHOICE == 2) - { - reconfig_autostart; - if (! $Default_Prompt ) { - goto RESTART; - } else { - print "Done OPA Driver Autostart Configuration.\n" - } - } -} -close_log; -exit $exit_code; diff --git a/CommonInstall/overrides_delta.pl b/CommonInstall/overrides_delta.pl new file mode 100644 index 00000000..7eabcdee --- /dev/null +++ b/CommonInstall/overrides_delta.pl @@ -0,0 +1,119 @@ +#!/usr/bin/perl +# BEGIN_ICS_COPYRIGHT8 **************************************** +# +# Copyright (c) 2015, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# END_ICS_COPYRIGHT8 **************************************** + +# [ICS VERSION STRING: unknown] +use strict; +#use Term::ANSIColor; +#use Term::ANSIColor qw(:constants); +#use File::Basename; +#use Math::BigInt; + + # Names of supported install components + # must be listed in depdency order such that prereqs appear 1st +# TBD ofed_vnic +my @delta_Components_other = ( "opa_stack", "ibacm", "intel_hfi", "mpi_selector", + "delta_ipoib", + "opa_stack_dev", "rdma_ndd", + "gasnet", "openshmem", + "mvapich2", "openmpi", + "delta_mpisrc", + "hfi1_uefi", + "delta_debug", ); +my @delta_Components_rhel72 = ( "opa_stack", "ibacm", "intel_hfi", "mpi_selector", + "delta_ipoib", + "opa_stack_dev", "rdma_ndd", + "gasnet", "openshmem", + "mvapich2", "openmpi", + "delta_mpisrc", + "hfi1_uefi", + "delta_debug", ); +my @delta_Components_sles12_sp2 = ( "opa_stack", "intel_hfi", "mpi_selector", + "delta_ipoib", + "opa_stack_dev", "rdma_ndd", + "gasnet", "openshmem", + "mvapich2", "openmpi", + "delta_mpisrc", + "hfi1_uefi", + "delta_debug", ); +my @delta_Components_rhel73 = ( "opa_stack", "ibacm", "intel_hfi", "mpi_selector", + "delta_ipoib", + "opa_stack_dev", "rdma_ndd", + "gasnet", "openshmem", + "mvapich2", "openmpi", + "delta_mpisrc", "hfi1_uefi", "delta_debug", ); +my @delta_Components_sles12_sp3 = ( "opa_stack", "intel_hfi", "mpi_selector", + "delta_ipoib", + "opa_stack_dev", "rdma_ndd", + "gasnet", "openshmem", + "mvapich2", "openmpi", + "delta_mpisrc", + "hfi1_uefi", + "delta_debug", ); +my @delta_Components_rhel74 = ( "opa_stack", "ibacm", "intel_hfi", "mpi_selector", + "delta_ipoib", + "opa_stack_dev", "rdma_ndd", + "gasnet", "openshmem", + "mvapich2", "openmpi", + "delta_mpisrc", "hfi1_uefi", "delta_debug", ); +@Components = ( ); +# delta_debug must be last + +# override some of settings in main_omnipathwrap_delta.pl +sub overrides() +{ + # The component list has slight variations per distro + if ( "$CUR_VENDOR_VER" eq "ES72" ) { + @Components = ( @delta_Components_rhel72 ); + } elsif ( "$CUR_VENDOR_VER" eq "ES122" ) { + @Components = ( @delta_Components_sles12_sp2 ); + } elsif ( "$CUR_VENDOR_VER" eq "ES73" ) { + @Components = ( @delta_Components_rhel73 ); + } elsif ( "$CUR_VENDOR_VER" eq "ES123" ) { + @Components = ( @delta_Components_sles12_sp3 ); + } elsif ( "$CUR_VENDOR_VER" eq "ES74" ) { + @Components = ( @delta_Components_rhel74 ); + } else { + @Components = ( @delta_Components_other ); + } + + # Sub components for autostart processing + @SubComponents = ( ); + + # TBD remove this concept + # no WrapperComponent (eg. opaconfig) + $WrapperComponent = ""; + + # set SrcDir for all components to . + # ofed_delta is a special component only used for the SrcDir of comp.pl + foreach my $comp ( @Components, "ofed_delta" ) + { + $ComponentInfo{$comp}{'SrcDir'} = "."; + } +} diff --git a/CommonInstall/rebuildsrpm.sh b/CommonInstall/overrides_ff.pl old mode 100755 new mode 100644 similarity index 50% rename from CommonInstall/rebuildsrpm.sh rename to CommonInstall/overrides_ff.pl index 9ef13412..fe182f0b --- a/CommonInstall/rebuildsrpm.sh +++ b/CommonInstall/overrides_ff.pl @@ -1,3 +1,4 @@ +#!/usr/bin/perl # BEGIN_ICS_COPYRIGHT8 **************************************** # # Copyright (c) 2015, Intel Corporation @@ -27,81 +28,37 @@ # # END_ICS_COPYRIGHT8 **************************************** -#[ICS VERSION STRING: unknown] +# [ICS VERSION STRING: unknown] +use strict; +#use Term::ANSIColor; +#use Term::ANSIColor qw(:constants); +#use File::Basename; +#use Math::BigInt; -# run this script from within the IntelOPA-Basic/*OFED* -# tree which is patched. It will recreate the ofa_kernel SRPMS -# it expects the ofa_kernel srpm to have been torn apart via: -# cd *OFED* -# mkdir patched -# cd patched -# rpm2cpio ../ofa_kernel*|cpi -icvd -# tar xvfz *.tgz -# edit source files as needed - -# this is strictly for internal use by development, not included in product -# however it is based on similar algorithms for reassemblind srpms which -# are part of scripts such as patch_ofed3.sh - -rebuild_srpm() +# override some of settings in main_omnipathwrap_delta.pl +sub overrides() { - # $1 of -R will reverse patch - # $1 of -C will remove all signs we patched it - clean= - reverse= - if [ "x$1" = "x-R" ] - then - reverse=$1 - elif [ "x$1" = "x-C" ] - then - clean=y - fi + # Names of supported install components + # must be listed in depdency order such that prereqs appear 1st + @Components = ( "oftools", "fastfabric", "opamgt_sdk" ); + + # Sub components for autostart processing + @SubComponents = ( ); - # this will force rebuild from srpm - rm -f RPMS/*/kernel-ib-1*.rpm + # TBD remove this concept + # no WrapperComponent (eg. opaconfig) + $WrapperComponent = ""; - cd SRPMS - srpm=`ls ofa_kernel-1*.src.rpm` - if [ ! -e $srpm-save ] - then - mv $srpm $srpm-save - else - if [ "x$reverse" = "x-R" ] - then - cp $srpm-save $srpm - return - else - rm $srpm - fi - fi - cd patched - tgz=`ls *.tgz` - base=`basename $tgz .tgz` - tar cfz $tgz $base - - # regenerate the patched srpm - rm -rf SOURCES SPECS SRPMS - mkdir SOURCES SPECS SRPMS - cp $tgz SOURCES/ - cp *.spec SPECS/ - rpmbuild -bs --define "_topdir `pwd`" SPECS/*.spec - cp SRPMS/*.src.rpm ../ - cd .. - if [ "x$clean" = "xy" ] - then - rm -rf $srpm-save - fi + # set SrcDir for all components to . + foreach my $comp ( @Components ) + { + $ComponentInfo{$comp}{'SrcDir'} = "."; + } } -if [ -d ../*OFED* ] -then - if [ ! -d SRPMS/patched ] - then - echo "the patched source must be in SRPMS/patched" - exit 1 - fi - rebuild_srpm $1 - echo "This ofa_kernel srpm has been rebuild and may now be installed" -else - echo "This must be run within the IntelOPA-*/*OFED* directory" 2>/dev/null -fi +# main_omnipathwrap_delta.pl calls this, but since we don't have comp_delta.pl +# we just provide a dummy function to keep PERL happy +# TBD - move this to util_init.pl? +sub init_delta_rpm_info($) +{ +} diff --git a/CommonInstall/repackage.sh b/CommonInstall/overrides_fm.pl old mode 100755 new mode 100644 similarity index 66% rename from CommonInstall/repackage.sh rename to CommonInstall/overrides_fm.pl index 257dd191..eb3fd057 --- a/CommonInstall/repackage.sh +++ b/CommonInstall/overrides_fm.pl @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/perl # BEGIN_ICS_COPYRIGHT8 **************************************** # # Copyright (c) 2015, Intel Corporation @@ -28,11 +28,37 @@ # # END_ICS_COPYRIGHT8 **************************************** -#[ICS VERSION STRING: unknown] -#!/bin/sh +# [ICS VERSION STRING: unknown] +use strict; +#use Term::ANSIColor; +#use Term::ANSIColor qw(:constants); +#use File::Basename; +#use Math::BigInt; -mkdir SOURCES SPECS SRPMS -cp ofa_kernel-1.4.tgz SOURCES/ -cp ofa_kernel.spec SPECS/ -rpmbuild -bs --define "_topdir `pwd`" SPECS/ofa_kernel.spec +# override some of settings in main_omnipathwrap_delta.pl +sub overrides() +{ + # Names of supported install components + # must be listed in depdency order such that prereqs appear 1st + @Components = ( "opafm" ); + # Sub components for autostart processing + @SubComponents = ( ); + + # TBD remove this concept + # no WrapperComponent (eg. opaconfig) + $WrapperComponent = ""; + + # set SrcDir for all components to . + foreach my $comp ( @Components ) + { + $ComponentInfo{$comp}{'SrcDir'} = "."; + } +} + +# main_omnipathwrap_delta.pl calls this, but since we don't have comp_delta.pl +# we just provide a dummy function to keep PERL happy +# TBD - move this to util_init.pl? +sub init_delta_rpm_info($) +{ +} diff --git a/CommonInstall/test_fm_install.sh b/CommonInstall/test_fm_install.sh deleted file mode 100644 index 929ac832..00000000 --- a/CommonInstall/test_fm_install.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/bash -# BEGIN_ICS_COPYRIGHT8 **************************************** -# -# Copyright (c) 2015, Intel Corporation -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# END_ICS_COPYRIGHT8 **************************************** - -#[ICS VERSION STRING: unknown] - -# this script allows simple unit testing of IntelOPA-FM installer. To run -# this, first install appropriate version of OFED, then cd into IntelOPA-FM-*/ -# directory (either subtree of IntelOPA-IFS or a direct build of VIEO_HOST) -# and run this script. If any of the tests fail, they say FAIL. -# also review the output carefully (recommend using "script" command when -# running) -# This requires a build of VIEO_HOST from HEAD or 4.4 after 9pm 11/5/2008 -# coding being tested was checked in at that time - -rm_config() -{ - rm -f /etc/sysconfig/iview_fm.config /etc/sysconfig/*rpmnew /etc/opa-fm/opafm.xml -} - -check_default() -{ - diff /etc/opa-fm/opafm.xml-sample /etc/opa-fm/opafm.xml - [ $? != 0 ] && echo "FAIL: installed does not match sample" - diff /etc/opa-fm/opafm.xml-sample /usr/share/opa-fm/opafm.xml - [ $? != 0 ] && echo "FAIL: sample does not match default" -} - -check_nodefault() -{ - diff /etc/opa-fm/opafm.xml-sample /etc/opa-fm/opafm.xml - [ $? != 0 ] || echo "FAIL: installed should not match sample" - diff /etc/opa-fm/opafm.xml-sample /usr/share/opa-fm/opafm.xml - [ $? != 0 ] && echo "FAIL: sample does not match default" -} - - -check_noiview() -{ - [ -f /etc/sysconfig/iview_fm.config ] && echo "FAIL: iview_fm.config installed" -} - -check_iview() -{ - [ -f /etc/sysconfig/iview_fm.config ] || echo "FAIL: iview_fm.config lost" -} - -check_norpmnew() -{ - [ -f /etc/sysconfig/*rpmnew ] && echo "FAIL: rpmnew found" -} - - -set -x -echo "=========================================================================" -echo "Install with no existing config" -rm_config -./INSTALL -a -check_default -check_noiview -check_norpmnew - -echo "=========================================================================" -echo "Install with iview_fm.config matching 4.4 version" -rm_config -cp /usr/lib/opa-fm/etc/iview_fm.config.4x /etc/sysconfig/iview_fm.config -./INSTALL -a -check_default -check_iview -check_norpmnew - -echo "=========================================================================" -echo "Install with iview_fm.config matching 4.3 version" -rm_config -cp /usr/lib/opa-fm/etc/iview_fm.config.4.3 /etc/sysconfig/iview_fm.config -./INSTALL -a -check_default -check_iview -check_norpmnew - -echo "=========================================================================" -echo "Install with iview_fm.config matching 4.3.1 version" -rm_config -cp /usr/lib/opa-fm/etc/iview_fm.config.4.3.1 /etc/sysconfig/iview_fm.config -./INSTALL -a -check_default -check_iview -check_norpmnew - -echo "=========================================================================" -echo "Install with iview_fm.config matching 4.2.1.2.1 version" -rm_config -cp /usr/lib/opa-fm/etc/iview_fm.config.4.2.1.2.1 /etc/sysconfig/iview_fm.config -./INSTALL -a -check_default -check_iview -check_norpmnew - -echo "=========================================================================" -echo "Install with opafm.xml matching 4.4 version" -rm_config -cp /usr/share/opa-fm/opafm.xml /etc/opa-fm/opafm.xml -./INSTALL -a -check_default -check_noiview -check_norpmnew - -echo "=========================================================================" -echo "Install with opafm.xml matching sample but not 4.4 version (eg. upgrade)" -rm_config -cp /usr/share/opa-fm/opafm.xml /etc/opa-fm/opafm.xml -echo "" >> /etc/opa-fm/opafm.xml -cp /etc/opa-fm/opafm.xml /etc/opa-fm/opafm.xml-sample -./INSTALL -a -check_default -check_noiview -check_norpmnew - -echo "=========================================================================" -echo "Install with modified opafm.xml" -rm_config -cp /usr/share/opa-fm/opafm.xml /etc/opa-fm/opafm.xml -echo "" >> /etc/opa-fm/opafm.xml -./INSTALL -a -check_nodefault -check_noiview -check_norpmnew - -echo "=========================================================================" -echo "Install with modified iview_fm.config" -rm_config -cp /usr/lib/opa-fm/etc/iview_fm.config.4x /etc/sysconfig/iview_fm.config -echo "#extra line" >> /etc/sysconfig/iview_fm.config -./INSTALL -a -check_nodefault -check_iview -check_norpmnew - diff --git a/CommonInstall/util_components.pl b/CommonInstall/util_components.pl index 961f82e1..65fd8f01 100755 --- a/CommonInstall/util_components.pl +++ b/CommonInstall/util_components.pl @@ -215,10 +215,6 @@ ($$$$$$) # ======================================================================= # Component processing -# indicate which main INSTALL is being used. This can influence error checks -# and assumptions made by individual components -my $MainInstall = ""; - # function must be supplied if any components set ComponentInfo{}{HasFirmware} sub update_hca_firmware(); @@ -1091,6 +1087,10 @@ ($) system "clear"; printf ("$BRAND OPA Install ($VERSION $DBG_FREE) Menu\n\n"); my $screens = int((scalar(@Components) - $num_hidden_comps + $maxlines-1)/$maxlines); + + if($GPU_Install == 1) { + printf ("Install GPU Direct components, ensure nvidia drivers + SDK are present \n\n"); + } if ($screens > 1 ) { printf ("Please Select Install Action (screen %d of $screens):\n", $firstline/$maxlines+1); diff --git a/CommonInstall/util_ifcfg.pl b/CommonInstall/util_ifcfg.pl index 59339bb0..9e22216d 100755 --- a/CommonInstall/util_ifcfg.pl +++ b/CommonInstall/util_ifcfg.pl @@ -43,6 +43,7 @@ # used for IPoIB at present but generalized so could support VNIC or # iPathEther also +my $FirstIPoIBInterface=0; # first device is ib0 my $MAX_HFI_PORTS=20; # maximum valid ports # Validate the passed in IP address (or netmask). diff --git a/CommonInstall/util_init.pl b/CommonInstall/util_init.pl index 829377ca..19791adc 100755 --- a/CommonInstall/util_init.pl +++ b/CommonInstall/util_init.pl @@ -301,6 +301,10 @@ () } elsif ( -s "/etc/SuSE-release" ) { $CUR_DISTRO_VENDOR = "SuSE"; $NETWORK_CONF_DIR = "/etc/sysconfig/network"; + } elsif ( -e "/usr/bin/lsb_release" ) { + $CUR_DISTRO_VENDOR = `/usr/bin/lsb_release -is`; + chop($CUR_DISTRO_VENDOR); + $CUR_DISTRO_VENDOR = lc($CUR_DISTRO_VENDOR); } else { # autodetermine the distribution open DISTRO_VENDOR, "ls /etc/*-release|grep -v lsb\|^os 2>/dev/null |" @@ -403,3 +407,9 @@ sub verify_distrib_files } } } + +# this will be replaced in component specific INSTALL with any special +# overrides of things in main*pl +sub overrides() +{ +} diff --git a/CommonInstall/util_rpm.pl b/CommonInstall/util_rpm.pl index 00d93023..4bf2bdc8 100755 --- a/CommonInstall/util_rpm.pl +++ b/CommonInstall/util_rpm.pl @@ -758,7 +758,7 @@ ($$$) } else { my $osver = rpm_tr_os_version("$mode"); # OS version # we expect 1 match, ignore all other filenames returned - if ( "$CUR_VENDOR_VER" eq 'ES122' ) { + if ( "$CUR_VENDOR_VER" eq 'ES122' || "$CUR_VENDOR_VER" eq 'ES123') { DebugPrint("Checking for Kernel Rpm: $rpmdir/${package}-${osver}_k*.${cpu}.rpm\n"); $rpmfile = file_glob("$rpmdir/${package}-${osver}_k*.${cpu}.rpm"); } else { @@ -819,7 +819,7 @@ ($$$) if ( "$mode" ne "user" && "$mode" ne "any" ) # kernel mode { NormalPrint "Rebuilding $package SRPM $mode\n"; - if (0 == build_srpm($package, $RPM_DIR, $BUILD_ROOT, $prefix, "append")) { + if (0 == build_srpm($package, $RPM_DIR, $BUILD_ROOT, $prefix, "append", $mode)) { delta_move_rpms("$RPM_DIR/$RPMS_SUBDIR", "$rpmdir"); goto RPM_RES; } @@ -870,7 +870,7 @@ ($$$$) if ( "$mode" ne "user" && "$mode" ne "any" ) # kernel mode { NormalPrint "Rebuilding $package SRPM $mode\n"; - if (0 == build_srpm($package, $RPM_DIR, $BUILD_ROOT, $prefix, "append")) { + if (0 == build_srpm($package, $RPM_DIR, $BUILD_ROOT, $prefix, "append", $mode)) { delta_move_rpms("$RPM_DIR/$RPMS_SUBDIR", "$rpmdir"); goto RPM_RES; } diff --git a/Esm/Makefile.linux b/Esm/Makefile.linux index 118158f5..ce38b232 100644 --- a/Esm/Makefile.linux +++ b/Esm/Makefile.linux @@ -57,9 +57,9 @@ DIRS += \ endif DIRS += \ $(TL_DIR)/Xml \ - $(TL_DIR)/Md5 \ $(TL_DIR)/Topology \ $(TL_DIR)/IbPrint \ + $(TL_DIR)/CodeVersion \ $(TL_DIR)/IbaTools/opaxmlextract \ $(TL_DIR)/IbaTools/opaxmlfilter \ $(TL_DIR)/IbaTools/FastFabric \ @@ -99,18 +99,24 @@ INSTALL_SOURCES = \ $(TL_DIR)/CommonInstall/util_driver.pl \ $(TL_DIR)/CommonInstall/util_components.pl \ $(TL_DIR)/CommonInstall/util_blacklist.pl \ + $(TL_DIR)/CommonInstall/util_ifcfg.pl \ $(TL_DIR)/CommonInstall/util_linuxconfig.pl \ + $(TL_DIR)/CommonInstall/util_hosttools.pl \ $(TL_DIR)/CommonInstall/util_rpm.pl \ $(TL_DIR)/CommonInstall/util_build.pl \ $(TL_DIR)/CommonInstall/comp_qlgc_fm.pl \ - $(TL_DIR)/CommonInstall/main_qlgc_fm.pl + $(TL_DIR)/CommonInstall/overrides_fm.pl \ + $(TL_DIR)/CommonInstall/main_omnipathwrap_delta.pl COMP_SOURCES = $(TL_DIR)/CommonInstall/comp_qlgc_fm.pl ifeq "$(BUILD_TARGET_OS_VENDOR_VERSION)" "ES72" PREREQ_SOURCE= $(TL_DIR)/CommonInstall/comp_fm_prereq_RHEL72.pl endif ifeq "$(BUILD_TARGET_OS_VENDOR_VERSION)" "ES73" - PREREQ_SOURCE= $(TL_DIR)/CommonInstall/comp_fm_prereq_RHEL72.pl + PREREQ_SOURCE= $(TL_DIR)/CommonInstall/comp_fm_prereq_RHEL73.pl +endif +ifeq "$(BUILD_TARGET_OS_VENDOR_VERSION)" "ES74" + PREREQ_SOURCE= $(TL_DIR)/CommonInstall/comp_fm_prereq_RHEL74.pl endif ifeq "$(BUILD_TARGET_OS_VENDOR_VERSION)" "ES121" PREREQ_SOURCE= $(TL_DIR)/CommonInstall/comp_fm_prereq_SLES121.pl @@ -118,6 +124,9 @@ endif ifeq "$(BUILD_TARGET_OS_VENDOR_VERSION)" "ES122" PREREQ_SOURCE= $(TL_DIR)/CommonInstall/comp_fm_prereq_SLES122.pl endif +ifeq "$(BUILD_TARGET_OS_VENDOR_VERSION)" "ES123" + PREREQ_SOURCE= $(TL_DIR)/CommonInstall/comp_fm_prereq_SLES123.pl +endif # Source files to include in DSP File DSP_SOURCES = $(INCLUDE_TARGETS) $(SOURCES) $(MISC_FILES) \ @@ -221,7 +230,7 @@ endif $(VS)$(STAGE_INSTALL) $(STAGE_INSTALL_DIR_OPT) $(PROJ_STAGE_DIR) README # put version number into a file to facilitate rpm construction -# presently only INSTALL allows dynamic version patch +# presently only INSTALL, sm and fe allow dynamic version patch prepfiles:: check_env ifeq "$(RELEASE_TAG)" "" $(CONVERT_RELEASETAG) $(MODULEVERSION) > $(PROJ_STAGE_DIR)/Version @@ -233,7 +242,10 @@ endif mkdir $$dir/stage.rpm; \ cp -r -L $(GLOBAL_BIN_DIR)/* $$dir/stage.rpm/ ; \ cp $(TL_DIR)/Esm/.comp_opafm.pl $$dir/stage.rpm/; \ - cd $$dir/stage.rpm && find . -print| $(PREP); + cd $$dir/stage.rpm ; \ + find . -print| $(PREP); \ + $(PATCH_VERSION) $(RELEASE_TAG) sm fe; \ + $(PATCH_BRAND) "$(BUILD_BRAND)" sm fe; cd $(PROJ_STAGE_DIR) && $(PATCH_VERSION) -m % $(RELEASE_TAG) INSTALL cd $(PROJ_STAGE_DIR) && $(PATCH_BRAND) -m % "$(BUILD_BRAND)" INSTALL @@ -257,25 +269,25 @@ vars_include: vars_include_global final_package: cd $(TL_DIR)/rpmbuild; \ - dir=`head -n1 BUILD/opa-fm-$${MKRPM_REL}/packaged_files |xargs dirname`; \ - filename=`head -n1 BUILD/opa-fm-$${MKRPM_REL}/packaged_files |xargs basename`; \ + dir=`head -n1 BUILD/opa-fm-$${MKRPM_VER}/packaged_files |xargs dirname`; \ + filename=`head -n1 BUILD/opa-fm-$${MKRPM_VER}/packaged_files |xargs basename`; \ subdir=$${filename%.tgz}; \ srpmdir=$$dir/$$subdir/SRPMS; \ arch=`echo $(BUILD_TARGET) | tr '[A-Z]' '[a-z]'`; \ rpmdir=$$dir/$$subdir/RPMS/$$arch;\ mkdir -p $$srpmdir; \ mkdir -p $$rpmdir; \ - cp SRPMS/opa-fm-$${MKRPM_REL}-$${MKRPM_VER}.src.rpm $$srpmdir/ ; \ - cp RPMS/$$arch/opa-fm-$${MKRPM_REL}-$${MKRPM_VER}.$$arch.rpm $$rpmdir/; \ - cp RPMS/$$arch/opa-fm-debuginfo-$${MKRPM_REL}-$${MKRPM_VER}.$$arch.rpm $$rpmdir/; \ + cp SRPMS/opa-fm-$${MKRPM_VER}-$${MKRPM_REL}.src.rpm $$srpmdir/ ; \ + cp RPMS/$$arch/opa-fm-$${MKRPM_VER}-$${MKRPM_REL}.$$arch.rpm $$rpmdir/; \ + cp RPMS/$$arch/opa-fm-debuginfo-$${MKRPM_VER}-$${MKRPM_REL}.$$arch.rpm $$rpmdir/; \ if [ "$(BUILD_TARGET_OS_VENDOR)" = "SuSE" ]; then \ - cp RPMS/$$arch/opa-fm-debugsource-$${MKRPM_REL}-$${MKRPM_VER}.$$arch.rpm $$rpmdir/; \ + cp RPMS/$$arch/opa-fm-debugsource-$${MKRPM_VER}-$${MKRPM_REL}.$$arch.rpm $$rpmdir/; \ fi; \ cd $$dir; \ echo "Packaging $$dir/$$filename ..."; \ tar cvfz $$filename $$subdir - cp $(TL_DIR)/rpmbuild/BUILD/opa-fm-$${MKRPM_REL}/packaged_files . - cp $(TL_DIR)/rpmbuild/BUILD/opa-fm-$${MKRPM_REL}/dist_files . + cp $(TL_DIR)/rpmbuild/BUILD/opa-fm-$${MKRPM_VER}/packaged_files . + cp $(TL_DIR)/rpmbuild/BUILD/opa-fm-$${MKRPM_VER}/dist_files . # Unit test execution #include $(TL_DIR)/Makerules/Maketargets.runtest diff --git a/Esm/Makerules.project b/Esm/Makerules.project index 1aedb041..7a4be97b 100755 --- a/Esm/Makerules.project +++ b/Esm/Makerules.project @@ -68,12 +68,8 @@ # Use of .999 below prevents RPM_VER from being "" if insufficient fields ifeq "$(RELEASE_TAG)" "" MODULEVERSION=$(shell $(PATCH_ENG_VERSION)) -RPM_REL=$(shell echo $(MODULEVERSION)|cut -d"." -f1-2) -RPM_VER=$(shell echo $(MODULEVERSION).999.999|cut -d"." -f3)$(shell rpm --eval %{?dist}) else MODULEVERSION=$(shell $(CONVERT_RELEASETAG) $(RELEASE_TAG)) -RPM_REL=$(shell echo $(MODULEVERSION)|cut -d"." -f1-4) -RPM_VER=$(shell echo $(MODULEVERSION).999.999.999.999|cut -d"." -f5)$(shell rpm --eval %{?dist}) endif RPM_NAME=opafm @@ -125,6 +121,8 @@ BSCPROJ = # strict-prototypes - treat extern int foo() as function with no args CPROJ = -DPRODUCT=$(PRODUCT) -DPRODUCT_$(PRODUCT) -DMODULEVERSION=$(MODULEVERSION) +# include buildFeatureDefs to let inplace build work for stream consistency +CPROJ += -include $(TL_DIR)/buildFeatureDefs ifeq ($(IB_STACK),OPENIB) CPROJ += -DIB_STACK_OPENIB else diff --git a/Esm/build.env b/Esm/build.env index fa310b08..91ea0fc7 100644 --- a/Esm/build.env +++ b/Esm/build.env @@ -1,5 +1,5 @@ # Adjust the environment variables if necessary export PRODUCT=VIEO_HOST -export RELEASE_TAG=10_5_0_0_136 +export RELEASE_TAG=10_6_0_0_132 export BUILD_CONFIG=${BUILD_CONFIG:-"release"} export BUILD_WITH_STACK=OPENIB diff --git a/Esm/build_label b/Esm/build_label index b0bbce8b..eb3d3409 100644 --- a/Esm/build_label +++ b/Esm/build_label @@ -1 +1 @@ -Build of VIEO_HOST 08/10/17 01:34 Tag: VIEO_HOST_LINUX_opa-10_5_10_5_0_0_136 +Build of VIEO_HOST 10/04/17 06:25 Tag: VIEO_HOST_LINUX_opa-10_6_10_6_0_0_132 diff --git a/Esm/fmbuild b/Esm/fmbuild index 3e9de96f..1158114e 100755 --- a/Esm/fmbuild +++ b/Esm/fmbuild @@ -1,11 +1,11 @@ #!/bin/bash # BEGIN_ICS_COPYRIGHT8 **************************************** -# -# Copyright (c) 2015, Intel Corporation -# +# +# Copyright (c) 2016, Intel Corporation +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: -# +# # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright @@ -14,7 +14,7 @@ # * Neither the name of Intel Corporation nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. -# +# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -25,13 +25,13 @@ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# +# # END_ICS_COPYRIGHT8 **************************************** # This is the main build script used with the FM src rpm's %build operation # Import the build environment -. build.env +. ./build.env export BUILD_PLATFORM="LINUX" @@ -44,14 +44,6 @@ settl # One must run target and setver before invoking this script. export BUILD_WITH_STACK=${BUILD_WITH_STACK:-OPENIB} -# A given release will be targeted for a specific version of ofed -# however we allow build.config to override if needed -# -# Its also OK to leave this blank as the makefiles have -# defaults in them, and thus you will run with the INSTALLED OFED -# whatever version that is... -#export OFED_STACK_PREFIX=${OFED_STACK_PREFIX:-/usr/ofed-1.5.2} - # Simple script to perform builds for current system/OS type export BUILD_TARGET=${BUILD_TARGET:-`uname -m`} case $BUILD_TARGET in diff --git a/Esm/ib/Makefile b/Esm/ib/Makefile index 4ec971dd..2feb880b 100755 --- a/Esm/ib/Makefile +++ b/Esm/ib/Makefile @@ -171,41 +171,8 @@ endif include $(TL_DIR)/Makerules/Maketargets.moduleinstall # install for stage phase -ifeq "$(BUILD_TARGET_OS)" "VXWORKS" -STAGE:: -else #include $(TL_DIR)/Makerules/Maketargets.modulestage -# create the opafm rpm -# lower case platform name -platform=$(shell echo $(BUILD_TARGET)| tr '[A-Z]' '[a-z]') -package: - rm -rf $(PROJ_STAGE_PACKAGES_DIR) - mkdir -p $(PROJ_STAGE_PACKAGES_DIR) - mkdir -p $(PROJ_STAGE_PACKAGES_DIR)/RPMS/$(platform) - mkdir -p $(PROJ_STAGE_PACKAGES_DIR)/BUILD - mkdir -p $(PROJ_STAGE_PACKAGES_DIR)/BUILDROOT - mkdir -p $(PROJ_STAGE_PACKAGES_DIR)/SOURCES - mkdir -p $(PROJ_STAGE_PACKAGES_DIR)/SPECS - mkdir -p $(PROJ_STAGE_PACKAGES_DIR)/SRPMS - sed -e "s/^Version:.*/Version:\ $(RPM_REL)/g" \ - -e "s/^Release:.*/Release:\ $(RPM_VER)/g" \ - -e "s/^Source:.*/Source:\ $(RPM_NAME)-$(RPM_REL).tar.gz/g" \ - < src/linux/rpm/vieo_fm.spec.base > $(PROJ_STAGE_PACKAGES_DIR)/SPECS/$(RPM_NAME).spec - # Append list of files to be installed to spec file - # strip the top part of the path away and replace it with the install dir. - cd $(PROJ_STAGE_IMAGE_DIR); find -type f -o -type l | sort | sed 's/./\/opt\/opafm/' >> $(PROJ_STAGE_PACKAGES_DIR)/SPECS/$(RPM_NAME).spec - cd $(STAGE_DIR) ; \ - tar cvfz $(PROJ_STAGE_PACKAGES_DIR)/SOURCES/$(RPM_NAME)-$(RPM_REL).tar.gz $(RPM_NAME)-$(RPM_REL) - rpmbuild \ - --buildroot $(PROJ_STAGE_PACKAGES_DIR)/BUILDROOT \ - --define '_unpackaged_files_terminate_build 1' \ - --define 'debug_package %{nil}' \ - --define 'dist %{nil}' \ - --define '__spec_build_pre %{___build_pre}' \ - --define "_topdir $(PROJ_STAGE_PACKAGES_DIR)" \ - -bb $(PROJ_STAGE_PACKAGES_DIR)/SPECS/$(RPM_NAME).spec - cp $(PROJ_STAGE_PACKAGES_DIR)/RPMS/$(platform)/$(RPM_NAME)-$(RPM_REL)-$(RPM_VER).$(platform).rpm $(PROJ_STAGE_DIR)/$(RPM_NAME)-$(RPM_REL)_$(RPM_VER).$(platform).rpm -endif +STAGE:: # Unit test execution #include $(TL_DIR)/Makerules/Maketargets.runtest diff --git a/Esm/ib/include/cs_context.h b/Esm/ib/include/cs_context.h index b513af99..f74da1fd 100644 --- a/Esm/ib/include/cs_context.h +++ b/Esm/ib/include/cs_context.h @@ -108,6 +108,7 @@ typedef struct _cntxt_entry { uint16_t retries; // retry count uint64_t RespTimeout; // current response timeout value (13.6.3.1) uint64_t cumulative_timeout; //sum of timeouts across retries + uint64_t totalTimeout; // total initial timeout value uint8_t senderWantsResponse; // 1 = sender wants the response on the resp_queue uint8_t sendFailed; // most recent attempt to send failed uint16_t releasing; // have begun to release diff --git a/Esm/ib/include/fm_xml.h b/Esm/ib/include/fm_xml.h index c1eb4c9e..221004e7 100644 --- a/Esm/ib/include/fm_xml.h +++ b/Esm/ib/include/fm_xml.h @@ -887,11 +887,13 @@ typedef struct _SMXmlConfig { char routing_algorithm[STRING_SIZE]; uint32_t path_selection; uint32_t queryValidation; + uint32_t enforceVFPathRecs; // Default to Enable to limit pathrecord scope to VFs + // otherwise, use PKEY as scope limit. uint32_t sma_batch_size; uint32_t max_parallel_reqs; uint32_t check_mft_responses; uint32_t min_supported_vls; - + uint64_t cumulative_timeout_limit; uint64_t non_resp_tsec; uint32_t non_resp_max_count; @@ -1185,10 +1187,6 @@ typedef struct _FEXmlConfig { uint32_t syslog_mode; char syslog_facility[STRING_SIZE]; FmParamU32_t log_masks[VIEO_LAST_MOD_ID+1]; - - uint32_t consistency_checksum; - uint32_t disruptive_checksum; - uint32_t overall_checksum; } FEXmlConfig_t; // FM configuration (Shared) @@ -1290,6 +1288,8 @@ extern int getXMLConfigData(uint8_t *buffer, uint32_t bufflen, uint32_t *filelen extern int putXMLConfigData(uint8_t *buffer, uint32_t filelen); extern int copyCompressXMLConfigFile(char *src, char *dst); extern int8_t copyDgVfInfo(FMXmlInstance_t *instance, DGXmlConfig_t *dg, VFXmlConfig_t *vf); +extern FSTATUS MatchImplicitMGIDtoVF(SMMcastDefGrp_t *mdgp, VirtualFabrics_t *vf_config); +extern FSTATUS MatchExplicitMGIDtoVF(SMMcastDefGrp_t *mdgp, VirtualFabrics_t *vf_config, int enforceVFPathRecs); // Export XML Memory mapping functions for the SM to use with the Topology lib on ESM #ifdef __VXWORKS__ diff --git a/Esm/ib/include/ib_sa.h b/Esm/ib/include/ib_sa.h index b988cce8..5665b808 100755 --- a/Esm/ib/include/ib_sa.h +++ b/Esm/ib/include/ib_sa.h @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT2 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -27,37 +27,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ** END_ICS_COPYRIGHT2 ****************************************/ -//----------------------------------------------------------------------/ -// / -// FILE NAME / -// ib_sa.h / -// / -// DESCRIPTION / -// SA specific structures / -// / -// DATA STRUCTURES / -// SAMad_t Common SA Mad header / -// NodeRecord_t NodeInfo Record / -// InformRecord_t Inform Record / -// ServiceRecord_t Service Record / -// PathRecord_t Path Record / -// McMemberRecord_t McMember Record / -// / -// FUNCTIONS / -// None / -// / -// DEPENDENCIES / -// ib_types.h / -// ib_mad.h / -// / -// / -// HISTORY / -// / -// NAME DATE REMARKS / -// jsy 12/28/00 Initial creation of file. / -// / -//----------------------------------------------------------------------/ - // -------------------------------------------------------------------- // // // // WARNING: These structures do NOT represent the IBTA defined // @@ -71,8 +40,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ib_types.h" #include "ib_mad.h" #include "cs_hashtable.h" -#include "iba/stl_sm.h" -#include "iba/stl_sa.h" +#include "iba/stl_sm_types.h" +#include "iba/stl_sa_priv.h" #if defined(__KERNEL__) && ! defined(__VXWORKS__) #include "linux/iba/public/ipackon.h" @@ -222,39 +191,12 @@ typedef struct { #define SA_VFABRIC_RECORD 0xFF02 // "Vendor unique" vfabric record #define SA_JOB_MANAGEMENT 0xFFB2 // job management extensions -// IBTA: Volume 1, Section 15.2.5.1 - // -// NodeRecord +// MWHEINZ FIXME: References to these typedefs should all be replaced +// with the equivalent IB_* SA record types. // -typedef struct { - Lid_t lid; // LID of CA port or LID of switch port 0 - uint16_t reserved; - STL_NODE_INFO nodeInfo; // NodeInfo - NodeDesc_t nodeDesc; // NodeDesc -} NodeRecord_t; -#define NR_COMPONENTMASK_LID 0x0000000000000001ull -#define NR_COMPONENTMASK_NI_NODETYPE 0x0000000000000010ull -#define NR_COMPONENTMASK_NODEGUID 0x0000000000000080ull -#define NR_COMPONENTMASK_PORTGUID 0x0000000000000100ull -#define NR_COMPONENTMASK_PORTNUMBER 0x0000000000001000ull - -// IBTA: Volume 1, Section 15.2.5.10 // -// PartitionRecord -// -typedef struct { - Lid_t portLid; // port LID - uint16_t blockNum; // Pkey table block number - uint8_t portNum; // switch port number - uint32_t rsrvd1; - STL_PARTITION_TABLE pkeyTable; // contents of PKey table -} PartitionRecord_t; -#define PKEY_COMPONENTMASK_PORTLID 0x0000000000000001ull -#define PKEY_COMPONENTMASK_BLOCKNUM 0x0000000000000002ull -#define PKEY_COMPONENTMASK_PORTNUM 0x0000000000000004ull - // IBTA: Volume 1, Section 15.2.5.11 // @@ -273,7 +215,7 @@ typedef InformRecord_t * InformRecordp; // // ServiceRecord -// +// #define SERVICE_RECORD_NAME_COUNT 64 //#define SERVICE_RECORD_GID_COUNT 16 @@ -311,34 +253,6 @@ typedef ServiceRecord_t * ServiceRecordp; // PathRecord // -#define PATH_RECORD_RSVD4_COUNT 6 - -typedef struct { - uint64_t serviceId; // service ID - IBTA: Section A13.5.3.1 - Gid_t dstGid; // destination GID - Gid_t srcGid; // source GID - Lid_t dstLid; // destination LID - Lid_t srcLid; // source LID - uint8_t raw; // raw flag - uint8_t rsvd2; // reserved - uint32_t flowLabel; // flow label - uint8_t hopLimit; // hop limit - uint8_t tClass; // tClass (GRH) - uint8_t reversible; // reversible path indicator/requirement - uint8_t numPath; // numbPath - PKey_t pKey; // partition key for this path - uint16_t qosClass; // QoS class - 12 bits, defined in A13.5.3.1 - uint8_t sl; // service level - 4 bits - uint8_t mtuSelector; // mtu selector - uint8_t mtuValue; // mtu value - uint8_t rateSelector; // rate selector - uint8_t rateValue; // rate value - uint8_t lifeSelector; // life time selector - uint8_t lifeValue; // life time value - uint8_t preference; // order of preference amongst multi paths - uint8_t rsvd4[PATH_RECORD_RSVD4_COUNT]; // reserved -} PathRecord_t; - /* IB 1.1 */ #define PR_COMPONENTMASK_NO_DST 0x0000000000000014ull #define PR_COMPONENTMASK_OK_SRC 0x0000000000001008ull @@ -397,27 +311,6 @@ typedef struct { uint8_t proxyJoin; uint32_t rsvd; } McMemberRecord_t; -// -// Multicast dbsync structures. -// -typedef struct { - Gid_t mGid; - uint32_t members_full; - uint32_t qKey; - uint16_t pKey; - Lid_t mLid; - uint8_t mtu; - uint8_t rate; - uint8_t life; - uint8_t sl; - uint32_t flowLabel; - uint8_t hopLimit; - uint8_t tClass; - uint8_t scope; - uint8_t filler; - uint16_t membercount; - uint32_t index_pool; /* Next index to use for new Mc Member records */ -} McGroupSync_t; #define MC_COMPONENTMASK_MGID 0x0000000000000001ull #define MC_COMPONENTMASK_PGID 0x0000000000000002ull @@ -477,37 +370,6 @@ typedef struct { // // IBTA: Volume 1r1.1, Section 15.2.5.20 -// -// MultiPathRecord -// - -typedef struct { - uint32_t raw; // raw flag - uint32_t rsvd; // reserved - uint32_t flowLabel; // flow label - uint8_t hopLimit; // hop limit - uint8_t tClass; // tClass (GRH) - uint8_t reversible; // reversible path indicator/requirement - uint8_t numPath; // numbPath - PKey_t pKey; // partition key for this path - uint16_t qosClass; // qos - 12 bits - as per IBTA: A13.5.3.2 - uint8_t sl; // service level - 4 bits - uint8_t mtuSelector; // mtu selector - uint8_t mtuValue; // mtu value - uint8_t rateSelector; // rate selector - uint8_t rateValue; // rate value - uint8_t lifeSelector; // life time selector - uint8_t lifeValue; // life time value - uint8_t serviceID8msb; // serviceId 8 MSB - uint8_t indepSelector; // independence selector - uint8_t rsvd3; // reserved - uint8_t sGidCount; // sgid count - uint8_t dGidCount; // dgid count - uint64_t serviceID56lsb; // 7 LSB of ServiceID -#define SGID1_OFFSET 24 // 192 bits - Table 179 of Vol1r1_1.pdf - Gid_t *sGidList; // pointer to sgid table - Gid_t *dGidList; // pointer to dgid table -} MultiPathRecord_t; #define MR_COMPONENTMASK_RAW 0x0000000000000001ull #define MR_COMPONENTMASK_FLOW 0x0000000000000004ull #define MR_COMPONENTMASK_HOP 0x0000000000000008ull @@ -526,27 +388,6 @@ typedef struct { #define MR_COMPONENTMASK_SRVID 0x0000000000010000ull #define MR_COMPONENTMASK_INDEP_SEL 0x0000000000020000ull -// -// OPA specific internal SA records. -// -// ***** WARNING ***** WARNING ***** WARNING ***** WARNING ***** -// -// These records can be changed at any time without notice. -// -// ***** WARNING ***** WARNING ***** WARNING ***** WARNING ***** -// - -// -// OpaServiceRecord_t - This is the same as the original with a -// timestamp appended. -// -typedef struct { - STL_SERVICE_RECORD serviceRecord; - uint64_t expireTime; - uint8_t pkeyDefined;// was the record created using pkey mask? -} OpaServiceRecord_t; -typedef OpaServiceRecord_t * OpaServiceRecordp; /* pointer to record */ - /* * subscriber table (informInfo) */ diff --git a/Esm/ib/include/ib_sm.h b/Esm/ib/include/ib_sm.h index 2909d0ae..3f8af0a2 100755 --- a/Esm/ib/include/ib_sm.h +++ b/Esm/ib/include/ib_sm.h @@ -313,7 +313,7 @@ typedef struct { // CapabilityMask. // // Note for STL capability mask: -// STL provides a bitfield definition for its capability mask. (see stl_sm.h) +// STL provides a bitfield definition for its capability mask. (see stl_sm_types.h) // Many capability bits that were optional in IB are now mandatory in STL. // However, as per STL1G1 spec, STL returns these "mandatory" capability // bits as 0. Be careful when checking STL capabilities and using @@ -439,7 +439,8 @@ typedef SMDBSync_t *SMDBSyncp; /* SM DBSYNC pointer type */ // version 5 - 10.3 release // version 6 - 10.4 release // version 7 - 10.5 release -#define FM_PROTOCOL_VERSION 7 +// version 8 - 10.6 release +#define FM_PROTOCOL_VERSION 8 typedef struct { uint32_t protocolVersion; @@ -451,9 +452,6 @@ typedef struct { // PM checksums uint32_t pmConfigChecksum; - // FE checksums - uint32_t feConfigChecksum; - // spare values for future expansion so packet framing does not need to change uint32_t spare1; uint32_t spare2; @@ -463,7 +461,7 @@ typedef struct { uint32_t spare6; uint32_t spare7; uint32_t spare8; - + uint32_t spare9; } SMDBCCCSync_t; typedef SMDBCCCSync_t *SMDBCCCSyncp; /* SM DBSYNC CCC pointer type */ diff --git a/Esm/ib/include/ib_status.h b/Esm/ib/include/ib_status.h index 23aeeec6..deb6ffaf 100755 --- a/Esm/ib/include/ib_status.h +++ b/Esm/ib/include/ib_status.h @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT2 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -201,6 +201,8 @@ typedef uint32_t Status_t; #define VSTATUS_UNRECOVERABLE (108) // a variant of BAD that indicates to the // caller that recovery (within a context) // should not be attempted +#define VSTATUS_TIMEOUT_LIMIT (109) // the maximum cumulative timeout limit + // was reached #define VSTATUS_ITERATOR_OUT_OF_DATE (119) // data referred by // iterator updated or deleted. #define VSTATUS_INSUFFICIENT_PERMISSION (120) // client has insufficient @@ -208,6 +210,7 @@ typedef uint32_t Status_t; #define VSTATUS_INVALID_CQ_HANDLE (126) // CQ handle is invalid #define VSTATUS_INVALID_FORMAT (127) // Data format is invalid #define VSTATUS_REJECT (128) // Request rejected +#define VSTATUS_DONE (129) // Request done // WHEN ADDING STATUS CODES, ALSO UPDATE cs_convert_status() in cs_utility.c diff --git a/Esm/ib/include/if3.h b/Esm/ib/include/if3.h index 61872950..7d3c0026 100755 --- a/Esm/ib/include/if3.h +++ b/Esm/ib/include/if3.h @@ -63,11 +63,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define SM_SERVICE_NAME "Primary Intel OmniPath Subnet Manager" #define SM_SERVICE_NAME_SEC "Secondary Intel OmniPath Subnet Manager" -#define PM_SERVICE_ID (0x1100d03c34845555ull) -#define PM_SERVICE_ID_SEC (0x1100d03c34845555ull) -#define PM_SERVICE_NAME "Primary Intel OmniPath Performance Manager" -#define PM_SERVICE_NAME_SEC "Secondary Intel OmniPath Performance Manager" - #define IF3_REGFORCE_PORT (1) /* force the registration */ #define IF3_REGFORCE_FABRIC (2) /* force the registration */ #define IF3_REGTRY_PORT (3) /* only try to register */ @@ -99,9 +94,9 @@ typedef void (*AsyncCallBack_t)(IBhandle_t fd , Mai_t *mad, void *context); typedef struct { uint8_t flag; /* flag indicating whether the entry is in use */ - Lid_t slid; /* this port lid */ - Lid_t dlid; /* the managers port lid */ - Lid_t saLid; /* where the sa lives */ + STL_LID slid; /* this port lid */ + STL_LID dlid; /* the managers port lid */ + STL_LID saLid; /* where the sa lives */ uint8_t lmc; /* lmc of port */ uint64_t SubnetTO; /* Subnet Timeout */ @@ -185,7 +180,7 @@ Status_t if3_cntrl_cmd_send(IBhandle_t fd, uint8_t cmd); Status_t if3_open(uint32_t dev, uint32_t port, uint8_t mclass, IBhandle_t * pfd); Status_t if3_close(IBhandle_t mhdl); Status_t if3_check_sa(IBhandle_t fd, int refresh, uint16_t *hasMoved); -Status_t if3_set_dlid(IBhandle_t fd, Lid_t dlid); +Status_t if3_set_dlid(IBhandle_t fd, STL_LID dlid); Status_t if3_mngr_locate_minfo(IBhandle_t rcv, ManagerInfo_t ** pt); diff --git a/Esm/ib/include/mai_g.h b/Esm/ib/include/mai_g.h index 6699510f..907efd8e 100755 --- a/Esm/ib/include/mai_g.h +++ b/Esm/ib/include/mai_g.h @@ -94,7 +94,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include "iba/stl_sm.h" +#include "iba/stl_sm_priv.h" #define MAD_BASEHDR_SIZE (24) diff --git a/Esm/ib/include/os_g.h b/Esm/ib/include/os_g.h index c646f9c2..ffd19e16 100755 --- a/Esm/ib/include/os_g.h +++ b/Esm/ib/include/os_g.h @@ -117,7 +117,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //---------------------------------------------------------------------// #elif defined(__VXWORKS__) -//#include // causes warnings due to duplicates of SM typdefs extern unsigned long SystemGetRandom(void); /* Get a random number between two numbers. * a%b will return a value between 0 and b-1 (inclusive). diff --git a/Esm/ib/include/vfi_g.h b/Esm/ib/include/vfi_g.h index 5e95321a..19d703fb 100755 --- a/Esm/ib/include/vfi_g.h +++ b/Esm/ib/include/vfi_g.h @@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ib_types.h" #include "mai_g.h" #include "ib_sa.h" -#include "stl_sa.h" +#include "stl_sa_priv.h" #define VFI_DEFAULT_GUID (0) diff --git a/Esm/ib/include/vs_g.h b/Esm/ib/include/vs_g.h index 14403cf3..657a6088 100755 --- a/Esm/ib/include/vs_g.h +++ b/Esm/ib/include/vs_g.h @@ -90,7 +90,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef __VS_G_ #define __VS_G_ -#include +#include #include #include #include @@ -407,6 +407,9 @@ sem_t osdSema; } Sema_t; +// +// MWHEINZ FIXME: Why are the cs_ functions prototyped here and not in cs_g.h? +// #define CS_SEMA_WAIT_FOREVER -1 #define CS_SEMA_NO_WAIT 0 extern Status_t cs_sema_create (Sema_t * handle, uint32_t count); @@ -418,7 +421,7 @@ extern Status_t cs_sema_getcount(Sema_t * handle, int *cnt); extern Status_t cs_psema_wait (Sema_t * handle, int timeout); /*=== Semaphores ===*/ -/*=== String Conversion ===*/ +/*=== String Operations ===*/ /* max/min values for uint*_t and int*_t */ #ifndef UINT8_MAX #define UINT8_MAX 255 @@ -526,7 +529,8 @@ extern Status_t cs_parse_gid (const char * str, Gid_t gid); extern char *cs_getAidName(uint16_t, uint16_t); extern char *cs_getMethodText(uint8_t); -/*=== String Conversion ===*/ +extern int cs_snprintfcat(char ** buf, size_t * len, char * fmt, ...) __attribute__((format(printf,3,4))); +/*=== String Operations ===*/ /*=== Computational Utility Functions ===*/ extern uint32_t cs_numSwitches(uint32_t subnet_size); diff --git a/Esm/ib/src/Makefile b/Esm/ib/src/Makefile index 0cca8651..5f8ea56e 100755 --- a/Esm/ib/src/Makefile +++ b/Esm/ib/src/Makefile @@ -125,13 +125,13 @@ CLOCAL = $(CPIE) -xc else CLOCAL = $(CPIE) endif -LOCALDEPLIBS = sm sa pm fe if3sa if3 cs mai ibaccess config rem_conf net public vslogu Xml Md5 opamgt-priv Topology IbPrint +LOCALDEPLIBS = sm sa pm fe if3sa if3 cs mai ibaccess config rem_conf net public vslogu Xml opamgt-priv Topology IbPrint # FIXME - need to build zlib so can use well defined version? LOCALLIBS=rt $(OPENIB_USER_LIBS) z ssl crypto LOCAL_INCLUDE_DIRS = $(TL_DIR)/Topology $(TL_DIR)/IbPrint ifneq "$(BUILD_TARGET_OS)" "VXWORKS" -LOCALLIBS+= expat +LOCALLIBS+= expat CodeVersion endif # Include Make Rules definitions and rules diff --git a/Esm/ib/src/config/Makefile b/Esm/ib/src/config/Makefile index ae4e52e0..d082935b 100644 --- a/Esm/ib/src/config/Makefile +++ b/Esm/ib/src/config/Makefile @@ -44,6 +44,7 @@ DIRS = # C files (.c) CFILES = \ fm_xml.c \ + fm_md5.c \ # Add more c files here # C++ files (.cpp) CCFILES = \ @@ -61,6 +62,7 @@ IDLFILE = DEFFILE = # targets to build during INCLUDES phase (add public includes here) INCLUDE_TARGETS = \ + fm_md5.h \ # Add more h hpp files here # Non-compiled files MISC_FILES = diff --git a/Esm/ib/src/config/fm_md5.c b/Esm/ib/src/config/fm_md5.c new file mode 100644 index 00000000..c7e6425c --- /dev/null +++ b/Esm/ib/src/config/fm_md5.c @@ -0,0 +1,70 @@ +/* BEGIN_ICS_COPYRIGHT5 **************************************** + +Copyright (c) 2017, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + * ** END_ICS_COPYRIGHT5 ****************************************/ + +#include +#include +#include +#include +#include +#include +#include "ib_types.h" + +#ifndef __VXWORKS__ +#include +#else +#include +#endif + +void fm_md5_start(void *ctx) +{ +#ifndef __VXWORKS__ + MD5_Init((MD5_CTX *)ctx); +#else + Md5_Start((Md5_Context_t *)ctx); +#endif +} + +void fm_md5_update(void *ctx, const void *data, size_t len) +{ +#ifndef __VXWORKS__ + MD5_Update((MD5_CTX *)ctx, data, len); +#else + Md5_Update((Md5_Context_t *)ctx, (unsigned char *)data, len); +#endif +} + +void fm_md5_finish(void *ctx, uint8_t *computedMd5) +{ +#ifndef __VXWORKS__ + MD5_Final(computedMd5, (MD5_CTX *)ctx); +#else + Md5_Finish((Md5_Context_t *)ctx, computedMd5); +#endif + +} diff --git a/Esm/ib/src/config/fm_md5.h b/Esm/ib/src/config/fm_md5.h new file mode 100644 index 00000000..e1602a5e --- /dev/null +++ b/Esm/ib/src/config/fm_md5.h @@ -0,0 +1,53 @@ +/* BEGIN_ICS_COPYRIGHT2 **************************************** + +Copyright (c) 2017, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +** END_ICS_COPYRIGHT2 ****************************************/ + +/* [ICS VERSION STRING: unknown] */ + +#ifndef _FM_MD5_HELPER_H_ +#define _FM_MD5_HELPER_H_ + +typedef struct { + uint32_t method; + union { + uint32_t simple_sum; +#ifndef __VXWORKS__ + MD5_CTX ctx; +#else + Md5_Context_t ctx; +#endif + } u; +} cksum_t; + + +void fm_md5_start(void *ctx); +void fm_md5_update(void *ctx, const void *data, size_t len); +void fm_md5_finish(void *ctx, uint8_t *computedMd5); + + +#endif diff --git a/Esm/ib/src/config/fm_xml.c b/Esm/ib/src/config/fm_xml.c index abf1d75c..768d54b1 100644 --- a/Esm/ib/src/config/fm_xml.c +++ b/Esm/ib/src/config/fm_xml.c @@ -34,6 +34,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include "if3.h" +#include #ifndef __VXWORKS__ #include @@ -47,7 +48,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #define _GNU_SOURCE +#ifndef __VXWORKS__ +#include +#else #include +#endif +#include "fm_md5.h" #ifdef __VXWORKS__ #include "Ism_Idb.h" @@ -359,13 +365,6 @@ uint32_t xml_compute_pool_size(uint8_t full) // Checksum code -typedef struct { - uint32_t method; - union { - uint32_t simple_sum; - Md5_Context_t ctx; - } u; -} cksum_t; static void *cksumBegin(uint32_t method) { @@ -381,7 +380,7 @@ static void *cksumBegin(uint32_t method) if (method == SIMPLE_CHECKSUM_METHOD) { cksum->u.simple_sum = 0; } else { - Md5_Start(&cksum->u.ctx); + fm_md5_start((void *)&cksum->u.ctx); } return (void *)cksum; } @@ -403,7 +402,7 @@ static void cksumData(void *ctx, void *block, uint32_t length) } } else { // MD5 checksum - Md5_Update(&cksum->u.ctx, block, length); + fm_md5_update((void *)&cksum->u.ctx, block, length); } } @@ -423,7 +422,7 @@ static uint32_t cksumEnd(void *ctx) uint32_t i; // MD5 checksum - Md5_Finish(&cksum->u.ctx, computedMd5); + fm_md5_finish((void *)&cksum->u.ctx, computedMd5); word = (uint32_t*)computedMd5; for (i = 0; i < 4; i++) { @@ -1425,8 +1424,6 @@ void feClearConfig(FEXmlConfig_t *fep) memset(fep->name, 0, sizeof(fep->name)); memset(fep->syslog_facility, 0, sizeof(fep->syslog_facility)); memset(fep->log_masks, 0, sizeof(fep->log_masks)); - - fep->overall_checksum = fep->disruptive_checksum = fep->consistency_checksum = 0; } // initialize FE defaults @@ -1445,28 +1442,17 @@ boolean feInitConfig(FEXmlConfig_t *fep, uint32_t instance, uint32_t ccc_method) if (!startFE) fep->start = 0; #endif - DEFAULT_INT(fep->start, 0); // FE defaults to disabled - if (!fep->start) { // if fe is diabled, set the checksums to 0 and return - fep->overall_checksum = 0; - fep->disruptive_checksum = 0; - fep->consistency_checksum = 0; - return 1; - } - - CKSUM_BEGIN(ccc_method); - // if the fe is enabled, do CKSUM checks - CKSUM_DATA(fep->start, CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_INT(fep->hca, 0, CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_INT(fep->port, 1, CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_INT(fep->port_guid, 0, CKSUM_OVERALL_DISRUPT); + DEFAULT_INT(fep->hca, 0); + DEFAULT_INT(fep->port, 1); + DEFAULT_INT(fep->port_guid, 0); - DEFAULT_AND_CKSUM_INT(fep->startup_retries, 5, CKSUM_OVERALL); - DEFAULT_AND_CKSUM_INT(fep->startup_stable_wait, 10, CKSUM_OVERALL); + DEFAULT_INT(fep->startup_retries, 5); + DEFAULT_INT(fep->startup_stable_wait, 10); // These are now processed when "fill" at end of parsing whole file - DEFAULT_AND_CKSUM_INT(fep->login, 0, CKSUM_OVERALL_DISRUPT_CONSIST); + DEFAULT_INT(fep->login, 0); DEFAULT_INT(fep->subnet_size, DEFAULT_SUBNET_SIZE); if (fep->subnet_size > MAX_SUBNET_SIZE) { @@ -1477,38 +1463,31 @@ boolean feInitConfig(FEXmlConfig_t *fep, uint32_t instance, uint32_t ccc_method) IB_LOG_WARN_FMT(__func__, "FE subnet size of %d is too small, setting to %d", fep->subnet_size, MIN_SUPPORTED_ENDPORTS); fep->subnet_size = MIN_SUPPORTED_ENDPORTS; } - CKSUM_DATA(fep->subnet_size, CKSUM_OVERALL_DISRUPT_CONSIST); - - DEFAULT_AND_CKSUM_INT(fep->debug, 0, CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_INT(fep->debug_rmpp, 0, CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_INT(fep->log_level, 1, CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_INT(fep->syslog_mode, 0, CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_INT(fep->listen, FE_LISTEN_PORT, CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_INT(fep->window, FE_WIN_SIZE, CKSUM_OVERALL_DISRUPT_CONSIST); + + DEFAULT_INT(fep->debug, 0); + DEFAULT_INT(fep->debug_rmpp, 0); + DEFAULT_INT(fep->log_level, 1); + DEFAULT_INT(fep->syslog_mode, 0); + DEFAULT_INT(fep->listen, FE_LISTEN_PORT); + DEFAULT_INT(fep->window, FE_WIN_SIZE); set_log_masks(fep->log_level, fep->syslog_mode, fep->log_masks); - CKSUM_DATA(fep->log_masks, CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_INT(fep->config_consistency_check_method, DEFAULT_CCC_METHOD, CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_STR(fep->CoreDumpLimit, "0", CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_STR(fep->CoreDumpDir, "/var/crash/opafm", CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_STR(fep->syslog_facility, "local6", CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_INT(fep->manager_check_rate, 60000000, CKSUM_OVERALL_DISRUPT_CONSIST); - DEFAULT_AND_CKSUM_INT(fep->SslSecurityEnabled, 0, CKSUM_OVERALL_DISRUPT); + DEFAULT_INT(fep->config_consistency_check_method, DEFAULT_CCC_METHOD); + DEFAULT_STR(fep->CoreDumpLimit, "0"); + DEFAULT_STR(fep->CoreDumpDir, "/var/crash/opafm"); + DEFAULT_STR(fep->syslog_facility, "local6"); + DEFAULT_INT(fep->manager_check_rate, 60000000); + DEFAULT_INT(fep->SslSecurityEnabled, 0); if (fep->SslSecurityEnabled) { - DEFAULT_AND_CKSUM_STR(fep->SslSecurityDir, FM_SSL_SECURITY_DIR, CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_STR(fep->SslSecurityFmCertificate, "fm_cert.pem", CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_STR(fep->SslSecurityFmPrivateKey, "fm_key.pem", CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_STR(fep->SslSecurityFmCaCertificate, "fm_ca_cert.pem", CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_INT(fep->SslSecurityFmCertChainDepth, 1, CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_STR(fep->SslSecurityFmDHParameters, "fm_dh_parms.pem", CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_INT(fep->SslSecurityFmCaCRLEnabled, 0, CKSUM_OVERALL_DISRUPT); - DEFAULT_AND_CKSUM_STR(fep->SslSecurityFmCaCRL, "fm_ca_crl.pem", CKSUM_OVERALL_DISRUPT); + DEFAULT_STR(fep->SslSecurityDir, FM_SSL_SECURITY_DIR); + DEFAULT_STR(fep->SslSecurityFmCertificate, "fm_cert.pem"); + DEFAULT_STR(fep->SslSecurityFmPrivateKey, "fm_key.pem"); + DEFAULT_STR(fep->SslSecurityFmCaCertificate, "fm_ca_cert.pem"); + DEFAULT_INT(fep->SslSecurityFmCertChainDepth, 1); + DEFAULT_STR(fep->SslSecurityFmDHParameters, "fm_dh_parms.pem"); + DEFAULT_INT(fep->SslSecurityFmCaCRLEnabled, 0); + DEFAULT_STR(fep->SslSecurityFmCaCRL, "fm_ca_crl.pem"); } - CKSUM_END(fep->overall_checksum, fep->disruptive_checksum, fep->consistency_checksum); - - if (xml_parse_debug) - fprintf(stdout, "Fe instance %u checksum overall %u disruptive %u consistency %u\n", (unsigned int)instance, - (unsigned int)fep->overall_checksum, (unsigned int)fep->disruptive_checksum, (unsigned int)fep->consistency_checksum); return 1; } @@ -1784,6 +1763,7 @@ boolean smInitConfig(SMXmlConfig_t *smp, SMDPLXmlConfig_t *dplp, SMMcastConfig_t DEFAULT_AND_CKSUM_INT(smp->config_consistency_check_level, DEFAULT_CCC_LEVEL, CKSUM_OVERALL_DISRUPT_CONSIST); DEFAULT_AND_CKSUM_INT(smp->path_selection, PATH_MODE_MINIMAL, CKSUM_OVERALL_DISRUPT_CONSIST); DEFAULT_AND_CKSUM_INT(smp->queryValidation, 0, CKSUM_OVERALL_DISRUPT_CONSIST); + DEFAULT_AND_CKSUM_INT(smp->enforceVFPathRecs, 1, CKSUM_OVERALL_DISRUPT_CONSIST); DEFAULT_INT(smp->sma_batch_size, 2); DEFAULT_INT(smp->max_parallel_reqs, 3); @@ -2020,6 +2000,8 @@ boolean smInitConfig(SMXmlConfig_t *smp, SMDPLXmlConfig_t *dplp, SMMcastConfig_t // FIXME: cjking - Temporary patch for FPGA related PR-124905 DEFAULT_AND_CKSUM_INT(smp->neighborFWAuthenEnable, 0, CKSUM_OVERALL_DISRUPT_CONSIST); + DEFAULT_AND_CKSUM_INT(smp->cumulative_timeout_limit, 300, CKSUM_OVERALL_DISRUPT_CONSIST); + CKSUM_STR(smp->dumpCounters, CKSUM_OVERALL_DISRUPT); // Add all of the DGs to the SM checksums @@ -2147,6 +2129,7 @@ void smShowConfig(SMXmlConfig_t *smp, SMDPLXmlConfig_t *dplp, SMMcastConfig_t *m printf("XML - routing_algorithm %s\n", smp->routing_algorithm); printf("XML - path_selection %u\n", (unsigned int)smp->path_selection); printf("XML - queryValidation %u\n", (unsigned int)smp->queryValidation); + printf("XML - enforceVFPathRecs %u\n", (unsigned int)smp->enforceVFPathRecs); printf("XML - sma_batch_size %u\n", (unsigned int)smp->sma_batch_size); printf("XML - max_parallel_reqs %u\n", (unsigned int)smp->max_parallel_reqs); printf("XML - check_mft_responses %u\n", (unsigned int)smp->check_mft_responses); @@ -3361,110 +3344,6 @@ void checksumVirtualFabricsConfig(VirtualFabrics_t *vfsip, SMXmlConfig_t *smp) return; } -// create a default Virtual Fabric Configuration in firmware -static boolean -addDefaultVirtualFabric(uint32_t fm, FMXmlCompositeConfig_t *config, VFXmlConfig_t *vf, char *error) -{ - VFConfig_t *vfp; - AppXmlConfig_t *app_config = &config->fm_instance[fm]->app_config; - AppConfig_t *app; - uint32_t i, j; - - if (app_config->appMapSize == MAX_VFABRIC_APPS) { - sprintf(error, "Maximum Applications allocated, cannot create default Virtual Fabric"); - return 0; - } - if (vf->number_of_vfs == MAX_ENABLED_VFABRICS) { - sprintf(error, "Maximum Virtual Fabrics allocated, cannot create default Virtual Fabric"); - return 0; - } - vfp = getVfObject(); - if (!vfp) { - return 0; - } - app = getApplicationObject(); - if (!app) { - freeXmlMemory(vfp, sizeof(VFConfig_t), "VFConfig_t addDefaultVirtualFabric"); - return 0; - } - - // Try to name the App "Default". If that name is in use, - // try appending a number until we find a name that is - // not in use. - cs_strlcpy(app->name, "Default", MAX_VFABRIC_NAME+1); - j = 0; - while (cl_qmap_get(&app_config->appMap, XML_QMAP_U64_CAST app->name) != cl_qmap_end(&app_config->appMap)) { - // Name already in use - j++; - sprintf(app->name, "Default_%d",j); - } - app->serviceIdMapSize = addMap(&app->serviceIdMap, XML_QMAP_U64_CAST PM_SERVICE_ID); - app->serviceIdRangeMapSize = 0; - app->serviceIdMaskedMapSize = 0; - app->number_of_mgids = 1; - cs_strlcpy(app->mgid[0].mgid,"0x0000000000000000:0x0000000000000000", MAX_VFABRIC_NAME+1); - app->number_of_mgid_ranges = 0; - app->number_of_mgid_range_maskeds = 0; - app->number_of_included_apps = 0; - app->select_sa = 1; - app->select_unmatched_sid = 0; - app->select_unmatched_mgid = 0; - app->select_pm = 1; - - // Try to name the VF "Default". If that name is in use, - // try appending a number until we find a name that is - // not in use. - cs_strlcpy(vfp->name, "Default", MAX_VFABRIC_NAME+1); - j = 0; - do { - for (i = 0; i < vf->number_of_vfs; i++) { - if (!strcmp(vf->vf[i]->name, vfp->name)) { - // Name already in use - j++; - sprintf(vfp->name, "Default_%d",j); - } - } - } while (i != vf->number_of_vfs); - - vfp->enable = 1; - vfp->standby = 0; - vfp->pkey = STL_DEFAULT_PKEY; - vfp->security = 0; - vfp->qos_enable = 0; - vfp->base_sl = UNDEFINED_XML8; - vfp->resp_sl = UNDEFINED_XML8; - vfp->mcast_sl = UNDEFINED_XML8; - vfp->flowControlDisable = UNDEFINED_XML8; - vfp->percent_bandwidth = UNDEFINED_XML8; - // uint8_t absolute_bandwidth; - vfp->priority = 0; - vfp->pkt_lifetime_mult = UNDEFINED_XML8; - - vfp->max_mtu_int = UNDEFINED_XML8; - vfp->max_rate_int = UNDEFINED_XML8; - vfp->preempt_rank = 0; - vfp->hoqlife_vf = UNDEFINED_XML8; - - vfp->number_of_full_members = 1; - sprintf(vfp->full_member[0].member,"All"); - - vfp->number_of_limited_members = 0; - - vfp->number_of_applications = 1; - cs_strlcpy(vfp->application[0].application, app->name, MAX_VFABRIC_NAME+1); - - if (!addMap(&app_config->appMap, XML_QMAP_U64_CAST app)) { - freeApplicationObject(app); - freeXmlMemory(vfp, sizeof(VFConfig_t), "VFConfig_t addDefaultVirtualFabric"); - return 0; - } - app_config->appMapSize++; - - vf->vf[vf->number_of_vfs++] = vfp; - - return 1; -} - boolean validateDefaultVirtualFabric(uint32_t fm, FMXmlCompositeConfig_t *config, VFXmlConfig_t *vf, char *error) { boolean default_pkey = 0; @@ -3480,12 +3359,9 @@ boolean validateDefaultVirtualFabric(uint32_t fm, FMXmlCompositeConfig_t *config } } } - if (default_pkey) { + if (default_pkey) sprintf(error, "Must have at least one non-standby Virtual Fabric with Mgmt Pkey"); - return 0; - } - // Try to create a default Virtual Fabric - return addDefaultVirtualFabric(fm, config, vf, error); + return 0; } // find a pointer to a Group given the name @@ -3692,11 +3568,66 @@ int includedGroups(FMXmlCompositeConfig_t *config, uint32_t fm, DGConfig_t **lis } return 0; } +// verify VFs are congruent +boolean VerifyCongruentVF(VF_t *v_fp1, VF_t *v_fp2, VFDg_t *mcp) +{ + uint8_t vf_sl1 = UNDEFINED_XML8; + uint8_t vf_sl2 = UNDEFINED_XML8; + + //checking PKey + if ((v_fp1->pkey != UNDEFINED_XML32) && (v_fp2->pkey != UNDEFINED_XML32) + && ((v_fp1->pkey & 0x7fff) != (v_fp2->pkey & 0x7fff))){ + return FALSE; + } + //check MTU + if ((GetBytesFromMtu(mcp->def_mc_mtu_int) > GetBytesFromMtu(v_fp1->max_mtu_int)) || + (GetBytesFromMtu(mcp->def_mc_mtu_int) > GetBytesFromMtu(v_fp2->max_mtu_int))) + return FALSE; + + // check rate + if ((IbStaticRateToMbps(mcp->def_mc_rate_int) > IbStaticRateToMbps(v_fp1->max_rate_int)) || + (IbStaticRateToMbps(mcp->def_mc_rate_int) > IbStaticRateToMbps(v_fp2->max_rate_int))) + return FALSE; + + // Check the SL's are the same + if ((v_fp1->qos_enable == 0) && (v_fp2->qos_enable ==0)) + return TRUE; // if both VF have QoS =0, the SLs will be equal. + // otherwise it is not known in advance and the user must + // specify them explicitly + if (v_fp1->qos_enable != 0) { + if (v_fp1->mcast_sl != UNDEFINED_XML8) + vf_sl1 = v_fp1->mcast_sl; + else { + if (v_fp1->base_sl == UNDEFINED_XML8) + return FALSE; + else vf_sl1 = v_fp1->base_sl; + } + } + + if (v_fp2->qos_enable != 0) { + if (v_fp2->mcast_sl != UNDEFINED_XML8) + vf_sl2 = v_fp2->mcast_sl; + else { + if (v_fp2->base_sl == UNDEFINED_XML8) + return FALSE; + else vf_sl2 = v_fp2->base_sl; + } + } -// check for duplicate MGID's within all DefaultGroups in a VirtualFabric -void checkDefaultGroupMGIDDuplicates(VirtualFabrics_t *vfsip, char *error) + if (vf_sl1 != vf_sl2) + return FALSE; + else + if ((vf_sl1 == UNDEFINED_XML8) && (vf_sl2 == UNDEFINED_XML8)) + return FALSE; + else return TRUE; +} + + +// check for duplicate MGID's within all DefaultGroups in all VirtualFabrics +// except itself. Duplicates within a VF are not checked here. +void checkDefaultGroupMGIDDuplicates(VirtualFabrics_t *vfsip, char *error, SMXmlConfig_t *smp) { - uint32_t vf; + uint32_t vf1, vf2; VFDg_t *dg_ref; VFDg_t *dg_check; VFAppMgid_t *mgid_ref; @@ -3707,25 +3638,36 @@ void checkDefaultGroupMGIDDuplicates(VirtualFabrics_t *vfsip, char *error) if (!error) return; - // go to each MGID and make sure no other MGID is the same - for (vf = 0; vf < vfsip->number_of_vfs; vf++) { - dg_ref = vfsip->v_fabric[vf].default_group; + for (vf1 = 0; vf1 < vfsip->number_of_vfs_all; vf1++) { + dg_ref = vfsip->v_fabric_all[vf1].default_group; while (dg_ref) { if (dg_ref->def_mc_create) { for_all_qmap_ptr(&dg_ref->mgidMap, item1, mgid_ref) { - dg_check = vfsip->v_fabric[vf].default_group; - while (dg_check) { - if (dg_check->def_mc_create) { - for_all_qmap_ptr(&dg_check->mgidMap, item2, mgid_check) { - if (mgid_ref == mgid_check) continue; - if (mgid_ref->mgid[0] == mgid_check->mgid[0] && mgid_ref->mgid[1] == mgid_check->mgid[1]) { - sprintf(error, "Duplicate MGID (0x%016"PRIx64":0x%016"PRIx64") in MulticastGroup definitions for VirtualFabric (%s)", - mgid_ref->mgid[0], mgid_ref->mgid[1], vfsip->v_fabric[vf].name); - return; + for (vf2 = 0; vf2 < vfsip->number_of_vfs_all; vf2++) { + if (vf1 == vf2) continue; + dg_check = vfsip->v_fabric_all[vf2].default_group; + while (dg_check) { + if (dg_check->def_mc_create) { + for_all_qmap_ptr(&dg_check->mgidMap, item2, mgid_check) { + if (mgid_ref->mgid[0] == mgid_check->mgid[0] && mgid_ref->mgid[1] == mgid_check->mgid[1]) { + if (!smp->enforceVFPathRecs) { + //verify VFs are congruent, if so, allow duplicates, otherwise fail config + if (!VerifyCongruentVF(&vfsip->v_fabric_all[vf1], &vfsip->v_fabric_all[vf2], dg_ref)) { + sprintf(error, "Duplicate MGID (0x%016"PRIx64":0x%016"PRIx64") in MulticastGroup definitions", + mgid_ref->mgid[0], mgid_ref->mgid[1]); + return; + } + } + else { + sprintf(error, "Duplicate MGID (0x%016"PRIx64":0x%016"PRIx64") in MulticastGroup definitions", + mgid_ref->mgid[0], mgid_ref->mgid[1]); + return; + } + } } } + dg_check = dg_check->next_default_group; } - dg_check = dg_check->next_default_group; } } } @@ -4186,8 +4128,6 @@ VirtualFabrics_t* renderVirtualFabricsConfig(uint32_t fm, FMXmlCompositeConfig_t uint32_t apps_in_list; SMMcastDefGrp_t *mdgp; - VFDg_t *dgip; - uint32_t default_group; uint32_t v_fabrics; uint32_t valid_vfs; @@ -4197,7 +4137,6 @@ VirtualFabrics_t* renderVirtualFabricsConfig(uint32_t fm, FMXmlCompositeConfig_t uint8_t num_bwundef_qos = 0; int32_t result; - uint8_t dg_match; uint8_t default_vf_check; uint8_t isPAAssigned = 0; @@ -4533,6 +4472,8 @@ VirtualFabrics_t* renderVirtualFabricsConfig(uint32_t fm, FMXmlCompositeConfig_t } } } + //MC groups will be initialized after all the VFs are done, in the meantime + vfip->number_of_default_groups = 0; vfip->requires_resp_sl = 0; vfip->contains_mcast = (vfip->apps.mgidMapSize != 0) || vfip->apps.select_unmatched_mgid; @@ -4553,11 +4494,11 @@ VirtualFabrics_t* renderVirtualFabricsConfig(uint32_t fm, FMXmlCompositeConfig_t // If this is a Default VF, make sure that SA, PM, or PA is included. if (default_vf_check) { - if (vfip->apps.select_sa || checkVFSID(vfip, PM_SERVICE_ID) || + if (vfip->apps.select_sa || checkVFSID(vfip, STL_PM_SERVICE_ID) || vfip->apps.select_pm ) { if (!vfp->standby) { if (vfip->apps.select_sa) isSAAssigned++; - if (checkVFSID(vfip, PM_SERVICE_ID)) isPAAssigned++; + if (checkVFSID(vfip, STL_PM_SERVICE_ID)) isPAAssigned++; if (vfip->apps.select_pm) isPMAssigned++; } } else { @@ -4569,7 +4510,7 @@ VirtualFabrics_t* renderVirtualFabricsConfig(uint32_t fm, FMXmlCompositeConfig_t goto fail; } - } else if (vfip->apps.select_sa || checkVFSID(vfip, PM_SERVICE_ID) || + } else if (vfip->apps.select_sa || checkVFSID(vfip, STL_PM_SERVICE_ID) || vfip->apps.select_pm ) { const char errStr[] = "Virtual Fabrics (%s) including , , " "or PA Service ID configured in an Application must use Mgmt Pkey"; @@ -4802,176 +4743,115 @@ VirtualFabrics_t* renderVirtualFabricsConfig(uint32_t fm, FMXmlCompositeConfig_t continue; } - // now we need to associate a Multicast DefaultGroup with this VirtualFabric - // scan for DefaultGroup VirtualFabric names that match this one - vfip->number_of_default_groups = 0; - for (default_group = 0; default_group < config->fm_instance[fm]->sm_mdg_config.number_of_groups; default_group++) { - mdgp = &config->fm_instance[fm]->sm_mdg_config.group[default_group]; - - dg_match = 0; + vfsip->number_of_vfs_all++; + valid_vfs++; + } - // if we have a match on a VirtualFabric then check the PKey - if (strlen(mdgp->virtual_fabric) > 0 && strcmp(mdgp->virtual_fabric, vfip->name) == 0) { - if (mdgp->def_mc_pkey != UNDEFINED_XML32 && vfip->pkey != UNDEFINED_XML32 && (mdgp->def_mc_pkey & 0x7fff) != (vfip->pkey & 0x7fff)) { - if (error) { - sprintf(error, "The MulticastGroup referencing VirtualFabric (%s) has a PKey (0x%4.4x) specified that does not match the PKey in that VirtualFabric", - vfp->name, (unsigned int)mdgp->def_mc_pkey); - goto fail; - } - continue; - } - dg_match = 1; - } + char mcerror[256]; + FSTATUS status=FSUCCESS; + int default_group; - // if we have a PKey match on a VirtualFabric then check the VirtualFabric name - if (dg_match == 0 && mdgp->def_mc_pkey != UNDEFINED_XML32 && vfip->pkey != UNDEFINED_XML32 && (mdgp->def_mc_pkey & 0x7fff) == (vfip->pkey & 0x7fff)) { - if (strlen(mdgp->virtual_fabric) > 0 && strcmp(mdgp->virtual_fabric, vfip->name) != 0) { - if (error) { - sprintf(error, "The MulticastGroup referencing PKey (0x%4.4x) has a VirtualFabric specified that does not match VirtualFabric (%s)", - (unsigned int)mdgp->def_mc_pkey, vfp->name); + uint32_t mg, mgj; + memset(mcerror, 0, sizeof(mcerror)); + //match explicit MGIDs with VFs + for (default_group = 0; default_group < config->fm_instance[fm]->sm_mdg_config.number_of_groups; default_group++) { + mdgp = &config->fm_instance[fm]->sm_mdg_config.group[default_group]; + if (mdgp->def_mc_create == 0) + continue; + // first assign VFs to all explicit MC groups + if (mdgp->number_of_mgids > 0 && mdgp->number_of_mgids < MAX_VFABRIC_DG_MGIDS) { + // check that the MGID is not duplicated within the group section + for (mg=0; mg < mdgp->number_of_mgids && mg < MAX_VFABRIC_DG_MGIDS; mg++) + for (mgj=0; mgj < mdgp->number_of_mgids && mgj < MAX_VFABRIC_DG_MGIDS; mgj++) { + if (mg == mgj) continue; + if (strncmp(mdgp->mgid[mg].mgid,mdgp->mgid[mgj].mgid, sizeof(mdgp->mgid[mg].mgid)) == 0) { + sprintf(mcerror,"Duplicate MGIDs in the same section."); + if (error) + snprintf(error, sizeof (mcerror), "Multicast group matching XML parse error - %s", mcerror); + else + fprintf(stdout, "Multicast group matching XML parse error - %s", mcerror); goto fail; } - continue; } - dg_match = 1; - } - // if we do have a match then make sure the SL's are the same regardless of whether QOS is enabled or not - if (dg_match) { - if (mdgp->def_mc_sl != UNDEFINED_XML8) { - if ((vfip->mcast_sl != UNDEFINED_XML8 && mdgp->def_mc_sl != vfip->mcast_sl) - || (vfip->base_sl != UNDEFINED_XML8 && mdgp->def_mc_sl != vfip->base_sl)) { - if (error) { - sprintf(error, "The MulticastGroup with SL (%u) references VirtualFabric (%s) that has a different QOS BaseSL (%u)", - (unsigned int)mdgp->def_mc_sl, vfp->name, (unsigned int)vfip->base_sl); - goto fail; - } - } - continue; + status = MatchExplicitMGIDtoVF(mdgp, vfsip, smp->enforceVFPathRecs); + if (status != FSUCCESS) { + switch (status) { + case FUNAVAILABLE: + sprintf(mcerror,"MC Groups could not be created, not enough memory."); + break; + case FINVALID_PARAMETER: + sprintf(mcerror, "All explicit MGIDs must match some application. "); + break; + case FINVALID_STATE: + sprintf(mcerror, "MGID matches more than a single VF."); + break; + case FNOT_FOUND: + sprintf(mcerror,"MGID did not match any enabled VF."); + break; + default: + break; } - } - - // if this Multicast DefaultGroup has neither a VirtualFabric or a PKey binding then include it anyway - if (dg_match == 0 && mdgp->def_mc_pkey == UNDEFINED_XML32 && strlen(mdgp->virtual_fabric) == 0) - dg_match = 1; - - // if no matches then check the next DefaultGroup - if (!dg_match) - continue; - - // go ahead and build the default group info - dgip = getDMCG(); - if (!dgip) { if (error) - sprintf(error, OUT_OF_MEMORY); - else fprintf(stdout, OUT_OF_MEMORY_RETURN); + snprintf(error, sizeof (mcerror), "Multicast group matching XML parse error - %s", mcerror); + else + fprintf(stdout, "Multicast group matching XML parse error - %s", mcerror); goto fail; } - // if Create not specified then default - if (mdgp->def_mc_create == UNDEFINED_XML32) - dgip->def_mc_create = 1; - else - dgip->def_mc_create = mdgp->def_mc_create; - - // take these settings verbatim since SM will handle - // the UNDEFINED_XML32 defaults correctly - dgip->def_mc_pkey = mdgp->def_mc_pkey; - dgip->def_mc_mtu_int = mdgp->def_mc_mtu_int; - dgip->def_mc_rate_int = mdgp->def_mc_rate_int; - dgip->def_mc_sl = mdgp->def_mc_sl; - - // if QKey is not specified then default - if (mdgp->def_mc_qkey == UNDEFINED_XML32) - dgip->def_mc_qkey = 0x0; - else - dgip->def_mc_qkey = mdgp->def_mc_qkey; - - // if FlowLabel is not specified then default - if (mdgp->def_mc_fl == UNDEFINED_XML32) - dgip->def_mc_fl = 0x0; - else - dgip->def_mc_fl = mdgp->def_mc_fl; - - // if TClass is not specified then default - if (mdgp->def_mc_tc == UNDEFINED_XML32) - dgip->def_mc_tc = 0x0; - else - dgip->def_mc_tc = mdgp->def_mc_tc; - - dgip->next_default_group = vfip->default_group; - vfip->default_group = dgip; - - // add all of the individual MGID's to the list - for (entry = 0; entry < mdgp->number_of_mgids; entry++) { - mgid = getAppMgid(); - if (!mgid) { - if (error) - sprintf(error, OUT_OF_MEMORY); - else fprintf(stdout, OUT_OF_MEMORY_RETURN); - goto fail; - } - - // since this is an individual MGID ID then set it up appropriately - verifyAndConvertMGidString(mdgp->mgid[entry].mgid, mgid); - - // if first one on list then place at head - if (addMap(&dgip->mgidMap, XML_QMAP_U64_CAST mgid)) { - dgip->mgidMapSize++; - } else { - freeAppMgid(mgid); - } - } - // add all of the MGID range values to the list - for (entry = 0; entry < mdgp->number_of_mgid_ranges; entry++) { - mgid = getAppMgid(); - if (!mgid) { - if (error) - sprintf(error, OUT_OF_MEMORY); - else fprintf(stdout, OUT_OF_MEMORY_RETURN); - goto fail; - } - - // since this is an MGID range then set it up appropriately - verifyAndConvertMGidCompoundString(mdgp->mgid_range[entry].range, /* range */ 1, mgid); - - // if first one on list then place at head - if (addMap(&dgip->mgidMap, XML_QMAP_U64_CAST mgid)) { - dgip->mgidMapSize++; - } else { - freeAppMgid(mgid); - } - } - // add all of the MGID masked values to the list - for (entry = 0; entry < mdgp->number_of_mgid_range_maskeds; entry++) { - mgid = getAppMgid(); - if (!mgid) { - if (error) - sprintf(error, OUT_OF_MEMORY); - else fprintf(stdout, OUT_OF_MEMORY_RETURN); - goto fail; - } - - // since this is an MGID mask then set it up appropriately - verifyAndConvertMGidCompoundString(mdgp->mgid_masked[entry].masked, /* range */ 0, mgid); - - // if first one on list then place at head - if (addMap(&dgip->mgidMap, XML_QMAP_U64_CAST mgid)) { - dgip->mgidMapSize++; - } else { - freeAppMgid(mgid); + } + } + //match implicit MGIDs with VFs + for (default_group = 0; default_group < config->fm_instance[fm]->sm_mdg_config.number_of_groups; default_group++) { + mdgp = &config->fm_instance[fm]->sm_mdg_config.group[default_group]; + // first assign VFs to all explicit MC groups + if (mdgp->def_mc_create == 0) + continue; + if (mdgp->number_of_mgids == 0) { + status = MatchImplicitMGIDtoVF(mdgp, vfsip); + if (status != FSUCCESS) { + switch (status) { + case FUNAVAILABLE: + sprintf(mcerror, "Implicit MC Groups could not be created, not enough memory."); + break; + case FINVALID_PARAMETER: + sprintf(mcerror, "All Implicit MGIDs must match some application."); + break; + case FINVALID_STATE: + sprintf(mcerror, "Implicit MGID matches more than a single VF."); + break; + case FNOT_FOUND: + sprintf(mcerror,"Implicit MC Group did not match any enabled VF."); + break; + default: + break; } + if (error) + snprintf(error, sizeof(mcerror),"Multicast group matching XML parse error - %s", mcerror); + else + fprintf(stdout, "Multicast group matching XML parse error - %s", mcerror); + goto fail; } - vfip->number_of_default_groups++; } + } - if (!vfp->standby) { - if (cloneVF(&vfsip->v_fabric[vfsip->number_of_vfs], vfip)) { + //create an array of active VFs + int i; + for(i=0; i < vfsip->number_of_vfs_all && i < MAX_ENABLED_VFABRICS; i++){ + if (!vfsip->v_fabric_all[i].standby) { + if (cloneVF(&vfsip->v_fabric[vfsip->number_of_vfs], &vfsip->v_fabric_all[i])) vfsip->number_of_vfs++; - } } - vfsip->number_of_vfs_all++; - valid_vfs++; + } + + // If there are no VFs the configuration is failed + if (!valid_vfs) { + const char errStr[] = "Virtual Fabric configuration is invalid."; + if (error) + sprintf(error, errStr); + else + fprintf(stdout,"%s\n", errStr); + goto fail; } // if there is at least 1 nonQos VF, BW can't be greater than 95% @@ -4999,26 +4879,26 @@ VirtualFabrics_t* renderVirtualFabricsConfig(uint32_t fm, FMXmlCompositeConfig_t } if (!isSAAssigned) { - const char errStr[] = "An Active Virtual Fabric must exist with configured in an Application"; + const char errStr[] = "An Active Virtual Fabric must exist with configured in an Application. "; if (error) sprintf(error, errStr); - else fprintf(stdout, errStr); + else fprintf(stdout,"%s\n", errStr); goto fail; } if (!isPMAssigned) { - const char errStr[] = "An Active Virtual Fabric must exist with configured in an Application"; + const char errStr[] = "An Active Virtual Fabric must exist with configured in an Application. "; if (error) sprintf(error, errStr); - else fprintf(stdout, errStr); + else fprintf(stdout,"%s\n", errStr); goto fail; } if (!isPAAssigned) { - const char errStr[] = "An Active Default Virtual Fabric must exist with PA Service ID configured in an Application"; + const char errStr[] = "An Active Default Virtual Fabric must exist with PA Service ID configured in an Application. "; if (error) sprintf(error, errStr); - else fprintf(stdout, errStr); + else fprintf(stdout,"%s\n", errStr); goto fail; } @@ -5028,7 +4908,7 @@ VirtualFabrics_t* renderVirtualFabricsConfig(uint32_t fm, FMXmlCompositeConfig_t fprintf(stdout, "Number of valid Virtual Fabrics %u\n", (unsigned int)valid_vfs); // for this VF check for duplicate MGID's in all default group - checkDefaultGroupMGIDDuplicates(vfsip, error); + checkDefaultGroupMGIDDuplicates(vfsip, error, smp); // calculate Virtual Fabric database checksum if (vfsip) @@ -5488,24 +5368,21 @@ static void SmMcastDgXmlParserEnd(IXmlParserState_t *state, const IXML_FIELD *fi goto cleanup; } - // see if this is a valid entry by checking all important fields - we need to do this - // to fix PR 114824 where an empty MulticastGroup is getting added to a VF since we allow - // the Create to be set if it is undefined. - if (mdgp->def_mc_create == UNDEFINED_XML32 && - mdgp->def_mc_pkey == UNDEFINED_XML32 && - mdgp->def_mc_mtu_int == UNDEFINED_XML8 && - mdgp->def_mc_rate_int == UNDEFINED_XML8 && - mdgp->def_mc_sl == UNDEFINED_XML8 && - mdgp->def_mc_qkey == UNDEFINED_XML32 && - mdgp->def_mc_fl == UNDEFINED_XML32 && - mdgp->def_mc_tc == UNDEFINED_XML32 && - dgMgidInstance == 0 && - dgMgidRangeInstance == 0 && - dgMgidMaskedInstance == 0) { - if (xml_parse_debug) - fprintf(stdout, "MulticastGroup ingnored since there are only empty tags with no substance\n"); - goto cleanup; - } + if (mdgp->def_mc_create == UNDEFINED_XML32) + mdgp->def_mc_create=1; + + if (mdgp->def_mc_mtu_int == UNDEFINED_XML8) + mdgp->def_mc_mtu_int = IB_MTU_2048; + + if (mdgp->def_mc_rate_int == UNDEFINED_XML8) + mdgp->def_mc_rate_int =IB_STATIC_RATE_25G; + + if (mdgp->def_mc_qkey == UNDEFINED_XML32) + mdgp->def_mc_qkey=0; + if (mdgp->def_mc_fl == UNDEFINED_XML32) + mdgp->def_mc_fl=0; + if (mdgp->def_mc_tc == UNDEFINED_XML32) + mdgp->def_mc_tc=0; // check for max (AFTER skipping uncreatable groups) if (defaultGroupInstance >= MAX_DEFAULT_GROUPS) { @@ -6476,6 +6353,20 @@ static void SmSweepIntervalParserEnd(IXmlParserState_t *state, *(uint64_t *)IXmlParserGetField(field, object) = timer; } +static void CumulativeTimeoutLimitParserEnd(IXmlParserState_t *state, + const IXML_FIELD *field, void *object, void *parent, XML_Char *content, + unsigned len, boolean valid) +{ + uint64_t value; + + if (!IXmlParseUint64(state, content, len, &value)) { + IXmlParserPrintError(state, "Invalid value"); + return; + } + + *(uint64_t *)IXmlParserGetField(field, object) = value * VTIMER_1S; +} + // fields within "Sm" tag static IXML_FIELD SmFields[] = { { tag:"Start", format:'u', IXML_FIELD_INFO(SMXmlConfig_t, start) }, @@ -6515,6 +6406,7 @@ static IXML_FIELD SmFields[] = { { tag:"ShortestPathBalanced", format:'u', IXML_FIELD_INFO(SMXmlConfig_t, shortestPathBalanced) }, { tag:"PathSelection", format:'u', IXML_FIELD_INFO(SMXmlConfig_t, path_selection), end_func:SmPathSelectionParserEnd }, { tag:"QueryValidation", format:'u', IXML_FIELD_INFO(SMXmlConfig_t, queryValidation) }, + { tag:"EnforceVFPathRecord", format:'u', IXML_FIELD_INFO(SMXmlConfig_t, enforceVFPathRecs) }, { tag:"SmaBatchSize", format:'u', IXML_FIELD_INFO(SMXmlConfig_t, sma_batch_size) }, { tag:"MaxParallelReqs", format:'u', IXML_FIELD_INFO(SMXmlConfig_t, max_parallel_reqs) }, { tag:"CheckMftResponses", format:'u', IXML_FIELD_INFO(SMXmlConfig_t, check_mft_responses) }, @@ -6609,6 +6501,7 @@ static IXML_FIELD SmFields[] = { { tag:"PortBounceLogLimit", format:'u', IXML_FIELD_INFO(SMXmlConfig_t, portBounceLogLimit) }, { tag:"NeighborFWAuthenEnable", format:'u', IXML_FIELD_INFO(SMXmlConfig_t, neighborFWAuthenEnable) }, { tag:"MinSupportedVLs", format:'u', IXML_FIELD_INFO(SMXmlConfig_t, min_supported_vls), end_func:MinSupportedVLsParserEnd }, + { tag:"CumulativeTimeoutLimit", format:'u', IXML_FIELD_INFO(SMXmlConfig_t, cumulative_timeout_limit), end_func:CumulativeTimeoutLimitParserEnd }, { NULL } }; @@ -8244,6 +8137,11 @@ static void VfXmlParserEnd(IXmlParserState_t *state, const IXML_FIELD *field, vo return; } + //security + if (vfp->security == UNDEFINED_XML32) + vfp->security = 0; + + // QOS Enable if (vfp->qos_enable == UNDEFINED_XML8) { vfp->qos_enable = 0; @@ -8466,6 +8364,7 @@ static void PmPgXmlParserEnd(IXmlParserState_t *state, const IXML_FIELD *field, { pgp = (PmPortGroupXmlConfig_t *)IXmlParserGetField(field, object); uint32_t i; + char *reservedGroups[] = {"All", "HFIs", "SWs"}; if (xml_parse_debug) fprintf(stdout, "PmPgXmlParserEnd instance %u PmPgInstance %u common %u\n", (unsigned int)instance, (unsigned int)PmPgInstance, (unsigned int)common); @@ -8487,19 +8386,26 @@ static void PmPgXmlParserEnd(IXmlParserState_t *state, const IXML_FIELD *field, } // If it has a name check for duplicates for (i = 0; i < PmPgInstance; i++) { - char *reservedGroups[] = {"All", "HFIs", "TFIs", "SWs"}; - int ii; - if (strcmp(pgp->Name, configp->fm_instance[instance]->pm_config.pm_portgroups[i].Name) == 0) { - IXmlParserPrintError(state, "Duplicate PmPortGroup (%s) encountered", pgp->Name); - freeXmlMemory(pgp, sizeof(PmPortGroupXmlConfig_t), "PmPortGroupXmlConfig_t PmPgXmlParserEnd()"); - return; - } - for (ii = 0; ii < 4; ii++) { - if (strcmp(pgp->Name, reservedGroups[ii]) == 0) { - IXmlParserPrintError(state, "PmPortGroup (%s) cannot have name of a default port group (All, HFIs, TFIs, SWs)", pgp->Name); + if (common) { + if (strcmp(pgp->Name, configp->fm_instance_common->pm_config.pm_portgroups[i].Name) == 0) { + IXmlParserPrintError(state, "Duplicate PmPortGroup (%s) encountered", pgp->Name); freeXmlMemory(pgp, sizeof(PmPortGroupXmlConfig_t), "PmPortGroupXmlConfig_t PmPgXmlParserEnd()"); return; } + } else if (configp->fm_instance[instance]) { + if (strcmp(pgp->Name, configp->fm_instance[instance]->pm_config.pm_portgroups[i].Name) == 0) { + IXmlParserPrintError(state, "Duplicate PmPortGroup (%s) encountered", pgp->Name); + freeXmlMemory(pgp, sizeof(PmPortGroupXmlConfig_t), "PmPortGroupXmlConfig_t PmPgXmlParserEnd()"); + return; + } + } + } + // Check the name is not a reserved group + for (i = 0; i < 3; i++) { + if (strcmp(pgp->Name, reservedGroups[i]) == 0) { + IXmlParserPrintError(state, "PmPortGroup (%s) cannot have name of a default port group (All, HFIs, SWs)", pgp->Name); + freeXmlMemory(pgp, sizeof(PmPortGroupXmlConfig_t), "PmPortGroupXmlConfig_t PmPgXmlParserEnd()"); + return; } } } @@ -8969,7 +8875,7 @@ static FSTATUS CheckAllVFsSecurity (VFXmlConfig_t *vf_c) // FM end tag static void FmXmlParserEnd(IXmlParserState_t *state, const IXML_FIELD *field, void *object, void *parent, XML_Char *content, unsigned len, boolean valid) { - char error[256]; + char error[1000]; VirtualFabrics_t *vf_config = NULL; if (xml_parse_debug) @@ -9023,7 +8929,7 @@ static void FmXmlParserEnd(IXmlParserState_t *state, const IXML_FIELD *field, vo instancep->fe_config.start = 1; #endif - if (!smInitConfig(&instancep->sm_config, &instancep->sm_dpl_config, + if (!smInitConfig(&instancep->sm_config, &instancep->sm_dpl_config, &instancep->sm_mc_config, &instancep->sm_mls_config, &instancep->dg_config, instance, instancep->fm_config.config_consistency_check_method) || !pmInitConfig(&instancep->pm_config, instance, instancep->fm_config.config_consistency_check_method) @@ -9095,15 +9001,18 @@ static void FmXmlParserEnd(IXmlParserState_t *state, const IXML_FIELD *field, vo memset(error, 0, sizeof(error)); if (instancep->sm_config.start && validateDefaultVirtualFabric(instance, configp, &instancep->vf_config, error)) { vf_config = renderVirtualFabricsConfig(instance, configp, &instancep->sm_config, error); + if (strlen(error)) { + IXmlParserPrintError(state, "Virtual Fabrics XML parse error - %s", error); + } } - if (strlen(error)) { + else if (strlen(error)) { IXmlParserPrintError(state, "Virtual Fabrics XML parse error - %s", error); } // free memory from test - if (vf_config != NULL) { + if (vf_config != NULL) { releaseVirtualFabricsConfig(vf_config); - vf_config = NULL; + vf_config = NULL; } } // index to next instance @@ -10032,3 +9941,304 @@ int main() exit(0); } #endif + + +static boolean verifyrange (uint64_t mgidRangeInitH, uint64_t mgidRangeInitL, uint64_t mgidRangeLastH, uint64_t mgidRangeLastL, + uint64_t mcgidH, uint64_t mcgidL) +{ + //check upper limit + if (mgidRangeLastH < mcgidH) + return FALSE; + else if (mgidRangeLastH == mcgidH) { + if (mcgidL > mgidRangeLastL) + return FALSE; + } + //check lower limit + if (mgidRangeInitH < mcgidH) + return TRUE; + else { + if (mgidRangeInitH == mcgidH) { + if (mcgidL < mgidRangeInitL) + return FALSE; + else return TRUE; + } + else return FALSE; + } +} + +static boolean checkMC_VFProperties (SMMcastDefGrp_t *mcp, VF_t *v_fp) +{ // check the VirtualFabric name + if (strlen(mcp->virtual_fabric) > 0 && strncmp(mcp->virtual_fabric, v_fp->name, sizeof(mcp->virtual_fabric)) != 0) { + return FALSE; + } + + //check pkey + if (mcp->def_mc_pkey != UNDEFINED_XML32 && v_fp->pkey != UNDEFINED_XML32 && + (mcp->def_mc_pkey & 0x7fff) != (v_fp->pkey & 0x7fff)) { + return FALSE; + } + //check MTU + if ( GetBytesFromMtu(mcp->def_mc_mtu_int) > GetBytesFromMtu(v_fp->max_mtu_int)) + return FALSE; + + // check rate + if (IbStaticRateToMbps(mcp->def_mc_rate_int) > IbStaticRateToMbps(v_fp->max_rate_int)){ + return FALSE; + } + // Check the SL's are the same + if (mcp->def_mc_sl != UNDEFINED_XML8) { + if (v_fp->qos_enable != 0) { + if (v_fp->mcast_sl != UNDEFINED_XML8) { + if (mcp->def_mc_sl != v_fp->mcast_sl) + return FALSE; + } + else if (mcp->def_mc_sl != v_fp->base_sl) + return FALSE; + } + else return FALSE; + } + return TRUE; +} + +static boolean searchMgidsThruAppsinVF (VF_t *vf_p, uint64_t mcgidh, uint64_t mcgidl) +{ + int mgidsV = 0; + VFAppMgid_t *mgidp; + cl_map_item_t *cl_map_item; + + // searching through mgids in applications of this VF + for_all_qmap_ptr(&vf_p->apps.mgidMap, cl_map_item, mgidp) { + //if there is a mask + if ((mgidp->mgid_mask[0] != 0xFFFFFFFFFFFFFFFFULL) || (mgidp->mgid_mask[1] != 0xFFFFFFFFFFFFFFFFULL)) { + if (((mgidp->mgid[0] == (mcgidh & mgidp->mgid_mask[0]))) && + ((mgidp->mgid[1] == (mcgidl & mgidp->mgid_mask[1])))) + mgidsV++; + }//if there is a range + else if ((mgidp-> mgid_last[0] != 0) || (mgidp-> mgid_last[1] != 0)) { + if (verifyrange(mgidp->mgid[0], mgidp-> mgid[1], mgidp->mgid_last[0], mgidp->mgid_last [1],mcgidh, mcgidl)) + mgidsV++; + }//if there is a single value + else if ((mgidp->mgid[0] == mcgidh) && (mgidp->mgid[1] == mcgidl)) + mgidsV++; + } + + if (mgidsV > 0) + return TRUE; + else + return FALSE; +} + +boolean PreCreateMCGroup (SMMcastDefGrp_t *mdgp, VF_t *matched_vf) +{ // create default group + VFDg_t *dgip; + // go ahead and build the default group info + VFAppMgid_t *mgidp; + dgip = getDMCG(); /// type VFDg_t + if (!dgip) { + matched_vf->default_group = NULL; + return FALSE; + } + + dgip->def_mc_create = mdgp->def_mc_create; + +// UNDEFINED_32XML were filled with default values before + uint32_t pkey = 0x8000 | matched_vf->pkey; + + dgip->def_mc_pkey = pkey; + dgip->def_mc_mtu_int = mdgp->def_mc_mtu_int; + dgip->def_mc_rate_int = mdgp->def_mc_rate_int; + if (matched_vf->mcast_sl != UNDEFINED_XML8) + dgip->def_mc_sl = matched_vf->mcast_sl; + else dgip->def_mc_sl = matched_vf->base_sl; + + dgip->def_mc_qkey = mdgp->def_mc_qkey; + dgip->def_mc_fl = mdgp->def_mc_fl; + dgip->def_mc_tc = mdgp->def_mc_tc; + + dgip->next_default_group = matched_vf->default_group; + matched_vf->default_group = dgip; + + // add all of the individual MGID's to the list + uint32_t entry; + for (entry = 0; entry < mdgp->number_of_mgids && entry < MAX_VFABRIC_DG_MGIDS; entry++) { + mgidp = getAppMgid(); + if (!mgidp) { + dgip = matched_vf->default_group->next_default_group; + freeDMCG(matched_vf->default_group); + matched_vf->default_group = dgip; + return FALSE; // + } + + // since this is an individual MGID ID then set it up appropriately + verifyAndConvertMGidString(mdgp->mgid[entry].mgid, mgidp); + + // if first one on list then place at head + if (addMap(&dgip->mgidMap, XML_QMAP_U64_CAST mgidp)) { + dgip->mgidMapSize++; + } else { + freeAppMgid(mgidp); + } + } + + matched_vf->number_of_default_groups++; + return TRUE; +} + +FSTATUS MatchExplicitMGIDtoVF (SMMcastDefGrp_t *mdgp, VirtualFabrics_t *v_fabricp, int enforceVFPathRecs) +// now we need to associate a Multicast Group with a VirtualFabric + +{ uint32_t number_of_vfs = 0; + uint32_t mg,i,j; + int vf = -1; + int matched_vf[MAX_ENABLED_VFABRICS] = {0}; + uint64 mcgid[2]; + boolean matchedAllMgids = TRUE; + +// all fabrics that get here are enabled (include Active and Standby) + for (i=0; i < v_fabricp->number_of_vfs_all && i < MAX_ENABLED_VFABRICS; i++) { + if (!checkMC_VFProperties(mdgp, &v_fabricp->v_fabric_all[i])) + continue; + matchedAllMgids = TRUE; + for (mg = 0; mg < mdgp->number_of_mgids && mg < MAX_VFABRIC_DG_MGIDS; mg++) { + StringToGid(&mcgid[0], &mcgid[1], mdgp->mgid[mg].mgid, NULL, TRUE); + //verify MGID matching by Application otherwise check unmatched + // search for the applications that are in the VF + // there is none >> fail config + if (searchMgidsThruAppsinVF(&v_fabricp->v_fabric_all[i], mcgid[0], mcgid[1])) + continue; + else if (v_fabricp->v_fabric_all[i].apps.select_unmatched_mgid){ + //check if no other VF contains the application gid + boolean matchedOtherVF=FALSE; + for (j=0; j < v_fabricp->number_of_vfs_all && j < MAX_ENABLED_VFABRICS; j++) { + if (i==j) continue; + if (searchMgidsThruAppsinVF(&v_fabricp->v_fabric_all[j], mcgid[0], mcgid[1])) { + matchedOtherVF=TRUE; + break; + } + } + if (matchedOtherVF) { + matchedAllMgids=FALSE; + break; + } + } + else { + matchedAllMgids=FALSE; + break; + } + } + if (matchedAllMgids) { + matched_vf[i] = 1; + number_of_vfs++; + if (vf == -1) vf = i; // Shortcut for later, save first matching VF. + } + }// end of searching for a single VF to match a MC group for explicit groups + + if (enforceVFPathRecs && number_of_vfs > 1) { // if more than one fail config + return FINVALID_STATE; + } + + if (number_of_vfs == 0) {// if not unmatched then fail + return FNOT_FOUND; + } + + /* This snippet below will copy the McGroups to all VFs that match. + However, note that the if check above that checks if the number of matching VFs + is more than 1. This check above makes sure that current behavior of one VF + per McGroup is maintained unless enforceVFPathRecs is false, by which multiple + VFs can then match an McGroup. */ + for (; vf < v_fabricp->number_of_vfs_all && vf < MAX_ENABLED_VFABRICS && number_of_vfs > 0; ++vf) { + if (matched_vf[vf] != 0) { + // If this is the first time creating this group + if (!PreCreateMCGroup(mdgp, &v_fabricp->v_fabric_all[vf])) { + return FUNAVAILABLE; + } + --number_of_vfs; + } + } + return FSUCCESS; +}// end of MatchExplicitGIDtoVF + + +FSTATUS MatchImplicitMGIDtoVF(SMMcastDefGrp_t *mdgp, VirtualFabrics_t *v_fabricp) +{ +#define MAX_NUM_IMPLICIT_MCG 8 + + typedef struct implicitMgid_t { + uint64_t Prefix; + uint64_t Postfix; + } implicitMgid; + + int i,j,k; + int number_of_vfs = 0; + uint64_t Prefix[MAX_NUM_IMPLICIT_MCG]; + VF_t *matched_vf=NULL; + boolean matchedAllMgids = TRUE; + implicitMgid mgids[8]; + uint64_t broadcast = 0x00000000ffffffff; + uint64_t allNodes = 0x0000000000000001; + uint64_t allRouters = 0x0000000000000002; + uint64_t other = 0x0000000000000016; + uint64_t mcastDns = 0x00000000000000fb; + uint64_t IPv4 = 0xff12401b00000000ull; + uint64_t IPv6 = 0xff12601b00000000ull; + + memset(mgids, 0, sizeof(mgids)); + + for (i =0; i<4; i++) Prefix[i] = IPv4; + for (i =4; i<8; i++) Prefix[i] = IPv6; + + mgids[0].Postfix = broadcast; + mgids[1].Postfix = allNodes; + mgids[2].Postfix = other; + mgids[3].Postfix = mcastDns; + mgids[4].Postfix = allNodes; + mgids[5].Postfix = allRouters; + mgids[6].Postfix = mcastDns; + mgids[7].Postfix = other; + + for (i=0; i < v_fabricp->number_of_vfs_all && i < MAX_ENABLED_VFABRICS; i++) { + if (!checkMC_VFProperties (mdgp, &v_fabricp->v_fabric_all[i])) + continue; + matchedAllMgids = TRUE; + for (j=0;jv_fabric_all[i].pkey; + mgids[j].Prefix = Prefix[j] | (pkey << 16 ); + sprintf(mdgp->mgid[j].mgid,"0x%016"PRIx64":0x%016"PRIx64,mgids[j].Prefix,mgids[j].Postfix); + if (searchMgidsThruAppsinVF(&v_fabricp->v_fabric_all[i], mgids[j].Prefix,mgids[j].Postfix)) { + continue; + } + else if (v_fabricp->v_fabric_all[i].apps.select_unmatched_mgid){ + //check if no other VF contains the application gid + boolean matchedOtherVF=FALSE; + for (k=0; k < v_fabricp->number_of_vfs_all && k < MAX_ENABLED_VFABRICS; k++) { + if (k==i) continue; + if (searchMgidsThruAppsinVF(&v_fabricp->v_fabric_all[k], mgids[j].Prefix,mgids[j].Postfix)) { + matchedOtherVF=TRUE; + break; + } + } + if (matchedOtherVF) { + matchedAllMgids=FALSE; + break; + } + } + else { + matchedAllMgids=FALSE; + break; + } + } + if (matchedAllMgids) { + matched_vf = &v_fabricp->v_fabric_all[i]; + mdgp->number_of_mgids=MAX_NUM_IMPLICIT_MCG; + number_of_vfs++; + if (!PreCreateMCGroup(mdgp, matched_vf)) + return FUNAVAILABLE; + } + }// create a group for all matched VF's + + if (number_of_vfs == 0) // not matched + return FNOT_FOUND; + + mdgp->number_of_mgids=0; + return FSUCCESS; +} diff --git a/Esm/ib/src/cs/cs_context.c b/Esm/ib/src/cs/cs_context.c index 480ef5e3..11abc695 100644 --- a/Esm/ib/src/cs/cs_context.c +++ b/Esm/ib/src/cs/cs_context.c @@ -59,7 +59,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ib_status.h" #include "cs_context.h" #include "mai_g.h" - +#include "ib_generalServices.h" #include "sm_counters.h" #include "pm_counters.h" @@ -342,7 +342,7 @@ count++; } } #endif - if (entry->mad.base.mclass == MAD_CV_PERF) { + if (entry->mad.base.mclass == MAD_CV_PERF || entry->mad.base.mclass == MAD_CV_SUBN_ADM) { datalen = MIN((uint32_t)entry->mad.datasize, STL_GS_DATASIZE); if ((status = mai_send_stl_timeout(cntx->ibHandle, &entry->mad, &datalen, entry->RespTimeout)) != VSTATUS_OK) { IB_LOG_ERROR_FMT(__func__, @@ -486,9 +486,9 @@ Status_t cs_cntxt_timeout_entry(cntxt_entry_t *tout_cntxt, generic_cntxt_t *cntx * If it will cause an overshoot, then just use whatever is left * from the total timeout */ - if ((tout_cntxt->cumulative_timeout < cntx->totalTimeout) && - ((tout_cntxt->cumulative_timeout + timeout) > cntx->totalTimeout)) { - timeout = cntx->totalTimeout - tout_cntxt->cumulative_timeout; + if ((tout_cntxt->cumulative_timeout < tout_cntxt->totalTimeout) && + ((tout_cntxt->cumulative_timeout + timeout) > tout_cntxt->totalTimeout)) { + timeout = tout_cntxt->totalTimeout - tout_cntxt->cumulative_timeout; /* if the timeout left is less than min, set it to the min. This will cause cumulative_timeout to overshoot * total_timeout by a bit, but that should be OK */ if (timeout < cntx->MinRespTimeout) @@ -508,7 +508,7 @@ Status_t cs_cntxt_timeout_entry(cntxt_entry_t *tout_cntxt, generic_cntxt_t *cntx IB_LOG_ERRORRC("can't resend notice reliably rc:", status); return VSTATUS_BAD; // send failed } - } else if ((cntx->MinRespTimeout != 0) && (tout_cntxt->cumulative_timeout < cntx->totalTimeout)) { + } else if ((cntx->MinRespTimeout != 0) && (tout_cntxt->cumulative_timeout < tout_cntxt->totalTimeout)) { /*stepped retry logic is being used, so retry till cumulative timeout * reaches total timeout */ @@ -637,6 +637,7 @@ cs_cntxt_get_nolock( Mai_t* mad, generic_cntxt_t *cntx, boolean wait ) --cntx->numFree; // reserve the context req_cntxt->alloced = 1; + req_cntxt->totalTimeout = cntx->totalTimeout; if (mad) { // save the output mad memcpy((void *)&req_cntxt->mad, mad, sizeof(Mai_t)); diff --git a/Esm/ib/src/cs/cs_hashtable.c b/Esm/ib/src/cs/cs_hashtable.c index f0faff79..8fecb756 100644 --- a/Esm/ib/src/cs/cs_hashtable.c +++ b/Esm/ib/src/cs/cs_hashtable.c @@ -27,7 +27,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ** END_ICS_COPYRIGHT5 ****************************************/ -//#include "cs_log.h" #define INLINE #include "cs_hashtable.h" #include diff --git a/Esm/ib/src/cs/cs_string.c b/Esm/ib/src/cs/cs_string.c index ceae9d4a..c311b331 100755 --- a/Esm/ib/src/cs/cs_string.c +++ b/Esm/ib/src/cs/cs_string.c @@ -66,6 +66,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "cs_g.h" #include "vs_g.h" #include "cs_log.h" +#include #define function __FUNCTION__ #ifdef LOCAL_MOD_ID #undef LOCAL_MOD_ID @@ -1416,3 +1417,47 @@ cs_parse_gid(const char * str, Gid_t gid) IB_EXIT(__FUNCTION__, rc); return rc; } + +/********************************************************************** +* +* DESCRIPTION +* Invokes snprintf to append the format string into the +* passed buffer. Will adjust the provided buffer pointer +* to just beyond the concatenated portion, and decrement +* len accordingly, such that a chain of invocations function +* as appends. +* +* INPUTS +* buf - Pointer to the output buffer. Will be incremented by +* the number of bytes written. +* len - Pointer to the remaining length. Will be decremented by +* the number of bytes written. +* fmt - printf-style format string. +* ... - pritnf-style format string arguments. +* +* OUTPUTS +* Returns the return value of printf. +* +**********************************************************************/ +int cs_snprintfcat(char ** buf, size_t * len, char * fmt, ...) +{ + if (!buf || !len || !fmt || !*len) + return 0; + + va_list(args); + va_start(args, fmt); + int n = vsnprintf(*buf, *len, fmt, args); + va_end(args); + + if (n <= 0) return n; + + // printf returns number of bytes that *would* be written. + // correct to actual bytes written + size_t m = MIN((size_t)n, *len); + + *buf += m; + *len -= m; + + return n; +} + diff --git a/Esm/ib/src/cs/cs_utility.c b/Esm/ib/src/cs/cs_utility.c index 8f82fb26..2dff6fd5 100755 --- a/Esm/ib/src/cs/cs_utility.c +++ b/Esm/ib/src/cs/cs_utility.c @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT5 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -56,11 +56,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "cs_log.h" #include "cs_queue.h" +#include "stl_mad_priv.h" #include "ib_mad.h" #include "ib_sa.h" -#include "ib_pa.h" +#include "stl_pa_priv.h" #include "sm_l.h" -#include "stl_sa.h" +#include "stl_sa_priv.h" #include "mai_g.h" #include "sm_dbsync.h" #include "if3.h" @@ -390,13 +391,15 @@ cs_convert_status (Status_t status) { case VSTATUS_INVALID_ITERATOR: return "105: resolver iterator invalid"; case VSTATUS_INVALID_MAGIC: return "106:Incorrect magic number"; case VSTATUS_BADPAGESIZE: return "107: invalid memory page size specified"; + case VSTATUS_UNRECOVERABLE: return "108: unrecoverable error"; + case VSTATUS_TIMEOUT_LIMIT: return "109: cumulative timeout limit reached"; case VSTATUS_ITERATOR_OUT_OF_DATE: return "119: data referred by case updated or deleted."; case VSTATUS_INSUFFICIENT_PERMISSION: return "120: client has insufficient privillages"; case VSTATUS_INVALID_CQ_HANDLE: return "126: CQ handle is invalid"; case VSTATUS_INVALID_FORMAT: return "127: Data format is invalid"; case VSTATUS_REJECT: return "128: Request rejected"; + case VSTATUS_DONE: return "129: Request done"; // a few extra just in case - case 129: return "129: Unknown status code"; case 130: return "130: Unknown status code"; case 131: return "131: Unknown status code"; case 132: return "132: Unknown status code"; @@ -416,7 +419,6 @@ char *cs_getAidName(uint16_t aidClass, uint16_t aid) { #define CASE_STL_SA_AID(aid) case STL_SA_ATTR_##aid: return #aid #define CASE_STL_PM_AID(aid) case STL_PM_ATTRIB_ID_##aid: return #aid #define CASE_MAD_CV(aid) case MAD_CV_##aid: return "Class " #aid -#define CASE_PA_AID(aid) case PA_ATTRID_##aid: return #aid #define CASE_STL_PA_AID(aid) case STL_PA_ATTRID_##aid: return #aid // Check common attribute ids first @@ -469,7 +471,6 @@ char *cs_getAidName(uint16_t aidClass, uint16_t aid) { CASE_MCLASS_AID(PORT_LFT); CASE_MCLASS_AID(PORT_GROUP); CASE_MCLASS_AID(AR_LIDMASK); - CASE_MCLASS_AID(ICS_LED_INFO); CASE_MCLASS_AID(COLLECTIVE_NOTICE); CASE_MCLASS_AID(CMLIST); CASE_MCLASS_AID(CFT); @@ -543,19 +544,19 @@ char *cs_getAidName(uint16_t aidClass, uint16_t aid) { } case MAD_CV_VFI_PM: switch (aid) { - CASE_PA_AID(GET_GRP_LIST); - CASE_PA_AID(GET_GRP_INFO); - CASE_PA_AID(GET_GRP_CFG); - CASE_PA_AID(GET_PORT_CTRS); - CASE_PA_AID(CLR_PORT_CTRS); - CASE_PA_AID(CLR_ALL_PORT_CTRS); - CASE_PA_AID(GET_PM_CONFIG); - CASE_PA_AID(FREEZE_IMAGE); - CASE_PA_AID(RELEASE_IMAGE); - CASE_PA_AID(RENEW_IMAGE); - CASE_PA_AID(GET_FOCUS_PORTS); - CASE_PA_AID(GET_IMAGE_INFO); - CASE_PA_AID(MOVE_FREEZE_FRAME); + CASE_STL_PA_AID(GET_GRP_LIST); + CASE_STL_PA_AID(GET_GRP_INFO); + CASE_STL_PA_AID(GET_GRP_CFG); + CASE_STL_PA_AID(GET_PORT_CTRS); + CASE_STL_PA_AID(CLR_PORT_CTRS); + CASE_STL_PA_AID(CLR_ALL_PORT_CTRS); + CASE_STL_PA_AID(GET_PM_CONFIG); + CASE_STL_PA_AID(FREEZE_IMAGE); + CASE_STL_PA_AID(RELEASE_IMAGE); + CASE_STL_PA_AID(RENEW_IMAGE); + CASE_STL_PA_AID(GET_FOCUS_PORTS); + CASE_STL_PA_AID(GET_IMAGE_INFO); + CASE_STL_PA_AID(MOVE_FREEZE_FRAME); CASE_STL_PA_AID(GET_VF_LIST); CASE_STL_PA_AID(GET_VF_INFO); CASE_STL_PA_AID(GET_VF_CONFIG); @@ -587,7 +588,7 @@ char *cs_getAidName(uint16_t aidClass, uint16_t aid) { #undef CASE_STL_SA_AID #undef CASE_STL_PM_AID #undef CASE_MAD_CV - +#undef CASE_STL_PA_AID return "UNKNOWN"; } diff --git a/Esm/ib/src/cs/vs_pool_common.c b/Esm/ib/src/cs/vs_pool_common.c index 55129539..fbd68852 100755 --- a/Esm/ib/src/cs/vs_pool_common.c +++ b/Esm/ib/src/cs/vs_pool_common.c @@ -49,10 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * DKJ 03/26/02 LINT cleanup * DKJ 04/01/02 PR1676. OS API 2.0g updates ***********************************************************************/ -#if defined (LINT) || defined (_lint) -#include -#include -#endif #include #include "cs_log.h" #define function __FUNCTION__ diff --git a/Esm/ib/src/fe/fe.h b/Esm/ib/src/fe/fe.h index 17c79016..e622aa11 100755 --- a/Esm/ib/src/fe/fe.h +++ b/Esm/ib/src/fe/fe.h @@ -93,7 +93,7 @@ void BSWAP_OOB_PACKET(OOBPacket *packet) /* Unsolicited Notice / Traps Structure */ struct Trap { uint32_t trapType; /* Type of Trap */ - Lid_t lidAddr; /* LID Address */ + STL_LID lidAddr; /* LID Address */ uint8_t portNum; /* Port number */ STL_NOTICE notice; struct Trap *next; diff --git a/Esm/ib/src/fe/fe_linux_proc.c b/Esm/ib/src/fe/fe_linux_proc.c index 3777b204..1bf3a4f5 100644 --- a/Esm/ib/src/fe/fe_linux_proc.c +++ b/Esm/ib/src/fe/fe_linux_proc.c @@ -439,7 +439,7 @@ uint8_t fe_is_thread(void) return 0; } -void +Status_t if3_set_rmpp_minfo (ManagerInfo_t *mi) { mi->rmppMngrfd = &fdsa; @@ -450,6 +450,7 @@ if3_set_rmpp_minfo (ManagerInfo_t *mi) // used to define the RMPP context pool sizes for the SA. mi->rmppDataLength = 512 * cs_numPortRecords(fe_config.subnet_size); mi->rmppMaxCntxt = 2 * fe_config.subnet_size; + return VSTATUS_OK; } int diff --git a/Esm/ib/src/fe/fe_mad.c b/Esm/ib/src/fe/fe_mad.c index 982ec263..a884bb22 100755 --- a/Esm/ib/src/fe/fe_mad.c +++ b/Esm/ib/src/fe/fe_mad.c @@ -54,7 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "if3.h" #include "ib_sa.h" -#include "stl_pa.h" +#include "stl_pa_priv.h" extern IBhandle_t fdsa,fd_pm,fd_dm; extern uint32_t fe_get_payload_length(uint8_t *netbuf); @@ -110,7 +110,7 @@ uint32_t fe_vieo_init(uint8_t *logName) if (pm_lid) rc = if3_lid_mngr_cnx(fe_config.hca,fe_config.port,MAD_CV_VFI_PM,pm_lid,&fd_pm); else - rc = if3_sid_mngr_cnx(fe_config.hca,fe_config.port,(void *)PM_SERVICE_NAME,PM_SERVICE_ID, + rc = if3_sid_mngr_cnx(fe_config.hca,fe_config.port,(void *)STL_PM_SERVICE_NAME,STL_PM_SERVICE_ID, MAD_CV_VFI_PM,&fd_pm); if (rc != VSTATUS_OK) { @@ -336,6 +336,7 @@ uint32_t fe_sa_passthrough(uint8_t *netbuf, FE_ConnList *connList, IBhandle_t fd case STL_SA_ATTR_SWITCH_PORT_CONG_RECORD: case STL_SA_ATTR_HFI_CONG_RECORD: case STL_SA_ATTR_HFI_CONG_CTRL_RECORD: + case STL_SA_ATTR_SWITCH_COST_RECORD: if(saMad->common.mr.s.Method != SUBN_ADM_GET && saMad->common.mr.s.Method != SUBN_ADM_GETTABLE){ badRequest = FE_UNSUPPORTED; } diff --git a/Esm/ib/src/fe/fe_main.c b/Esm/ib/src/fe/fe_main.c index 2cbed87f..fc04f7fb 100755 --- a/Esm/ib/src/fe/fe_main.c +++ b/Esm/ib/src/fe/fe_main.c @@ -69,6 +69,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "opamgt_sa_priv.h" #endif +#ifndef __VXWORKS__ +#include +#endif + #include "iba/ib_rmpp.h" #define SA_CHECK_TIMEOUT 10000000 /* Timeout check SA in micr sec */ @@ -117,9 +121,6 @@ extern FEXmlConfig_t fe_config; extern void if3RmppDebugOn(void); #endif -// checksum info -uint32_t fe_overall_checksum = 0; -uint32_t fe_consistency_checksum = 0; // XML debug tracing static uint32_t xml_trace = 0; @@ -180,15 +181,6 @@ void fe_process_config(FMXmlCompositeConfig_t *xml_config, uint32_t fe_instance) feShowConfig(&fe_config); } - if (xml_trace) { - printf("XML - FE old overall_checksum %llu new overall_checksum %llu\n", - (long long unsigned int)fe_overall_checksum, (long long unsigned int)fe_config.overall_checksum); - printf("XML - FE old consistency_checksum %llu new consistency_checksum %llu\n", - (long long unsigned int)fe_consistency_checksum, (long long unsigned int)fe_config.consistency_checksum); - } - fe_overall_checksum = fe_config.overall_checksum; - fe_consistency_checksum = fe_config.consistency_checksum; - #ifdef __VXWORKS__ if (fe_config.debug_rmpp) if3RmppDebugOn(); @@ -321,6 +313,10 @@ int fe_main() fe_init_log_setting(); #endif vs_log_output_message("Fabric Executive starting up.", TRUE); +#ifndef __VXWORKS__ + vs_log_output(VS_LOG_NONE, VIEO_NONE_MOD_ID, NULL, NULL, + "FE: Version: %s", GetCodeVersion()); +#endif #ifndef __VXWORKS__ @@ -556,7 +552,7 @@ int fe_main() IB_LOG_VERBOSE("trying to re-register FE with PM", 0); // reset connection to PM - if(if3_sid_mngr_cnx(fe_config.hca, fe_config.port, (void *)PM_SERVICE_NAME, PM_SERVICE_ID, MAD_CV_VFI_PM, &fd_pm) == FSUCCESS){ + if(if3_sid_mngr_cnx(fe_config.hca, fe_config.port, (void *)STL_PM_SERVICE_NAME, STL_PM_SERVICE_ID, MAD_CV_VFI_PM, &fd_pm) == FSUCCESS){ IB_LOG_INFINI_INFO("connection to PM reinitialized, fd_pm=", fd_pm); } else { IB_LOG_VERBOSE("Failed to reconnect to PM, will try again later", 0); diff --git a/Esm/ib/src/fe/fe_proc/Makefile b/Esm/ib/src/fe/fe_proc/Makefile index 5afee139..6bb4c3cd 100755 --- a/Esm/ib/src/fe/fe_proc/Makefile +++ b/Esm/ib/src/fe/fe_proc/Makefile @@ -117,11 +117,11 @@ INCLUDE_SUBDIR = CLOCAL = -DUNIX $(CPIE) LOCAL_INCLUDE_DIRS=$(MOD_DIR)/src/smi/include $(MOD_DIR)/src/fe/ $(OPENIB_USER_LIB_DIRS) -LOCALDEPLIBS = if3 if3sa net cs mai ibaccess config vslogu public Xml Md5 opamgt-priv +LOCALDEPLIBS = if3 if3sa net cs mai ibaccess config vslogu public Xml opamgt-priv LOCALLIBS=rt ssl crypto $(OPENIB_USER_LIBS) ifneq "$(BUILD_TARGET_OS)" "VXWORKS" -LOCALLIBS+= expat +LOCALLIBS+= expat CodeVersion endif # Include Make Rules definitions and rules diff --git a/Esm/ib/src/fe/fe_trap_thread.c b/Esm/ib/src/fe/fe_trap_thread.c index ad8fd784..1a056fd3 100644 --- a/Esm/ib/src/fe/fe_trap_thread.c +++ b/Esm/ib/src/fe/fe_trap_thread.c @@ -54,7 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "fe_trap_thread.h" #include "sa/if3_sa.h" -#include "opamgt_sa_priv.h" +#include "opamgt_sa_notice.h" extern uint32_t g_fe_nodes_len; // len of node data in fe_in_buff extern FE_ConnList *clist; // pointer to connection list @@ -188,59 +188,29 @@ void fe_trap_thread_resume(void) IB_EXIT(__func__, 0); } -static void Ib2Stl_Notice(IB_NOTICE *ibp, STL_NOTICE *stlp) -{ - STL_TRAP_GID *stlTrapDataDetails = (STL_TRAP_GID *)stlp->Data; - TRAPS_64_65_66_67_DETAILS *ibTrapDataDetails = (TRAPS_64_65_66_67_DETAILS *)ibp->Data; - - stlp->Attributes.Generic.u.AsReg32 = ibp->u.Generic.u.AsReg32; - stlp->Attributes.Generic.TrapNumber = ibp->u.Generic.TrapNumber; - stlp->Attributes.Vendor.u.AsReg32 = ibp->u.Vendor.u.AsReg32; - stlp->Attributes.Vendor.DeviceID = ibp->u.Vendor.DeviceID; - stlp->IssuerLID = ibp->IssuerLID; - stlp->Stats.s.Toggle = ibp->Stats.Toggle; - stlp->Stats.s.Count = ibp->Stats.Count; - stlp->IssuerGID = ibp->IssuerGID; - - // replicate Data Detail fields - switch (ibp->u.Generic.TrapNumber) { - case SMA_TRAP_GID_NOW_IN_SERVICE: - case SMA_TRAP_GID_OUT_OF_SERVICE: - case SMA_TRAP_ADD_MULTICAST_GROUP: - case SMA_TRAP_DEL_MULTICAST_GROUP: - memcpy(&stlTrapDataDetails->Gid, &ibTrapDataDetails->GIDAddress, sizeof(IB_GID)); - break; - default: - memcpy(stlp->Data, ibp->Data, sizeof(ibp->Data)); - break; - } -} - static uint32_t fe_if3_trap_thread_get_notice(STL_NOTICE *notice) { FSTATUS status; - int len; - + size_t len; + STL_NOTICE *stl_notice = NULL; + IB_ENTER(__func__, notice, 0, 0, 0); - - status = omgt_sa_get_event(fe_omgt_session, - (void*)fe_trap_thread_data.data, - FE_TRAP_THREAD_DATA_LEN, &len); + + status = omgt_sa_get_notice_report(fe_omgt_session, &stl_notice, &len, NULL, -1); + if (status != FSUCCESS) { IB_LOG_WARN("failure while waiting for incoming fabric event; status:", status); IB_EXIT(__func__, FAILED); return FAILED; - } else if (len < sizeof(IB_NOTICE)) { + } else if (len < sizeof(STL_NOTICE)) { IB_LOG_WARN("invalid data length returned; length:", len); IB_EXIT(__func__, FAILED); return FAILED; } - - // convert notice host byte order - (void)BSWAP_IB_NOTICE((IB_NOTICE *)fe_trap_thread_data.data); - // convert STL notice to IB notice - (void)Ib2Stl_Notice((IB_NOTICE *)fe_trap_thread_data.data, notice); - + memcpy(fe_trap_thread_data.data, stl_notice, len); + memcpy(notice, stl_notice, sizeof(*notice)); + free(stl_notice); + IB_EXIT(__func__, SUCCESS); return SUCCESS; } diff --git a/Esm/ib/src/fe/net/libnet.h b/Esm/ib/src/fe/net/libnet.h index 4d889372..30c8c81e 100755 --- a/Esm/ib/src/fe/net/libnet.h +++ b/Esm/ib/src/fe/net/libnet.h @@ -69,7 +69,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif -#include "iba/stl_mad.h" +#include "iba/stl_mad_priv.h" #include "iba/ib_generalServices.h" #include "netblob.h" diff --git a/Esm/ib/src/fe/sa/if3_sa.c b/Esm/ib/src/fe/sa/if3_sa.c index bcd23c54..3b7c8bb6 100755 --- a/Esm/ib/src/fe/sa/if3_sa.c +++ b/Esm/ib/src/fe/sa/if3_sa.c @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #ifdef IB_STACK_OPENIB -#include "opamgt_sa_priv.h" +#include "opamgt_sa_notice.h" #endif extern FEXmlConfig_t fe_config; @@ -128,7 +128,7 @@ fe_if3_get_node_by_port_guid(uint64_t portguid, STL_NODE_RECORD* nr) BSWAPCOPY_STL_NODE_RECORD(&nrec, (STL_NODE_RECORD *)fe_sa_send_buf); pack.method = SA_CM_GETTABLE; - pack.mask = NR_COMPONENTMASK_PORTGUID; // match on portGuid + pack.mask = IB_NODE_RECORD_COMP_PORTGUID; // match on portGuid pack.recsize = sizeof(STL_NODE_RECORD); pack.rec = fe_sa_send_buf; pack.data = fe_sa_recv_buf; @@ -611,7 +611,7 @@ fe_if3_get_traps(FE_Trap_t* trapinfo,uint32_t* found) STL_NOTICE notice; FE_Trap_t *temp,*top; FE_Trap_t current={0}; - Lid_t tempLid; + STL_LID tempLid; uint64_t timeout=50000; // 50 millisecs FE_Trap_Processing_State_t state; SA_MAD_HDR *sa_hdr; diff --git a/Esm/ib/src/fe/sa/if3_sa.h b/Esm/ib/src/fe/sa/if3_sa.h index 588d78b4..e36ec63f 100755 --- a/Esm/ib/src/fe/sa/if3_sa.h +++ b/Esm/ib/src/fe/sa/if3_sa.h @@ -64,7 +64,7 @@ typedef struct { uint32_t found; uint32_t toBeProcessed; - Lid_t smlid; + STL_LID smlid; uint32_t trap128Received; } FE_Trap_Processing_State_t; diff --git a/Esm/ib/src/ibaccess/cs_mad_openib.c b/Esm/ib/src/ibaccess/cs_mad_openib.c index b2481177..ae5b5e83 100644 --- a/Esm/ib/src/ibaccess/cs_mad_openib.c +++ b/Esm/ib/src/ibaccess/cs_mad_openib.c @@ -36,16 +36,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "opamgt_priv.h" #include #include -#include #include #include -#include +#include #include #include -#include -#include +#include +#include #include -#include +#include //============================================================================== @@ -631,7 +630,7 @@ stl_send_sma(IBhandle_t handle, Mai_t * mai, uint64_t timeout) memset(&addr, 0, sizeof(addr)); addr.lid = mai->addrInfo.dlid; - addr.qpn = mai->addrInfo.srcqp; + addr.qpn = mai->addrInfo.destqp; addr.qkey = mai->addrInfo.qkey; addr.pkey = mai->addrInfo.pkey; addr.sl = mai->addrInfo.sl; diff --git a/Esm/ib/src/ibaccess/vs_evt.c b/Esm/ib/src/ibaccess/vs_evt.c index e1a7521d..2c875a23 100644 --- a/Esm/ib/src/ibaccess/vs_evt.c +++ b/Esm/ib/src/ibaccess/vs_evt.c @@ -51,10 +51,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ***********************************************************************/ -#if defined(LINT) -#define __signed__ signed -#include -#endif #include #include #include diff --git a/Esm/ib/src/ibaccess/vs_lck.c b/Esm/ib/src/ibaccess/vs_lck.c index aa31e38f..5bfefc6b 100755 --- a/Esm/ib/src/ibaccess/vs_lck.c +++ b/Esm/ib/src/ibaccess/vs_lck.c @@ -69,10 +69,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifdef BUILD_RHEL4 #define _POSIX_C_SOURCE 200112L #endif -#if defined(LINT) -#define __signed__ signed -#include -#endif #include #include #include diff --git a/Esm/ib/src/ibaccess/vs_thr.c b/Esm/ib/src/ibaccess/vs_thr.c index 502950b9..440782d0 100755 --- a/Esm/ib/src/ibaccess/vs_thr.c +++ b/Esm/ib/src/ibaccess/vs_thr.c @@ -51,11 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SFW 03/10/02 Initial functions all passing testcases. * MGR 04/19/02 Changed pthread_kill call to pthread_cancel. ***********************************************************************/ -//#if defined(LINT) #include -#define __signed__ signed -#include -//#endif #include #include #include diff --git a/Esm/ib/src/if3/felib.c b/Esm/ib/src/if3/felib.c index 007f2ee8..90f05b06 100755 --- a/Esm/ib/src/if3/felib.c +++ b/Esm/ib/src/if3/felib.c @@ -50,8 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "mai_g.h" #include "mal_g.h" #include "ib_sa.h" -#include "iba/ib_pa.h" -#include "iba/stl_pa.h" +#include "iba/stl_pa_priv.h" #include "ib_sm.h" #include "iba/ib_rmpp.h" #include @@ -85,7 +84,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define DRAIN_MAI_STALE(fd) drain_stale(fd) extern uint8_t if3_is_master(void); -extern void if3_set_rmpp_minfo(ManagerInfo_t *mi); +extern Status_t if3_set_rmpp_minfo(ManagerInfo_t *mi); static ManagerInfo_t maninfo[MAX_MANAGER]; @@ -470,7 +469,7 @@ Status_t if3_addr_swizzle (Mai_t * mad) { - Lid_t lid; + STL_LID lid; /* * swap the source and destination address */ @@ -1027,7 +1026,7 @@ if3_dbsync_close (IBhandle_t mhdl) } -Status_t if3_set_dlid (IBhandle_t fd, Lid_t dlid) +Status_t if3_set_dlid (IBhandle_t fd, STL_LID dlid) { Status_t rc=VSTATUS_OK; ManagerInfo_t *mi; @@ -1307,7 +1306,7 @@ open_mngr_cnx(uint32_t dev, uint32_t port, } else if (mode == 0) { // we have the lid of the manager location - mi->dlid = (Lid_t)lid; + mi->dlid = (STL_LID)lid; } else { // manager is local mi->dlid = mi->slid; @@ -1834,7 +1833,11 @@ if3_dbsync_reply_to_mngr(IBhandle_t fhdl, Mai_t * fmad, } // setup RMPP related fields - (void)if3_set_rmpp_minfo(mi); + rc = if3_set_rmpp_minfo(mi); + if (rc) { + IB_EXIT(__func__, rc); + return rc; + } // set return status fmad->base.status = (uint16_t)resp_status; @@ -1924,7 +1927,11 @@ if3_mngr_send_mad(IBhandle_t fd, SA_MAD *psa, uint32_t dataLength, uint8_t *buff } // setup RMPP related fields - (void)if3_set_rmpp_minfo(mi); + rc = if3_set_rmpp_minfo(mi); + if (rc) { + IB_EXIT(__func__, rc); + return rc; + } // // calculating Response Timeout Period @@ -2147,7 +2154,11 @@ if3_mngr_send_passthru_mad (IBhandle_t fd, SA_MAD *psa, uint32_t dataLength, } // setup RMPP related fields - (void)if3_set_rmpp_minfo(mi); + rc = if3_set_rmpp_minfo(mi); + if (rc) { + IB_EXIT(__func__, rc); + return rc; + } // // calculating Response Timeout Period @@ -2291,6 +2302,7 @@ if3_mngr_send_passthru_mad (IBhandle_t fd, SA_MAD *psa, uint32_t dataLength, } else { // release context for single MAD request rmpp_cntxt_full_release(fe_cntxt); + fe_cntxt = NULL; // wait for response from manager rc = rmpp_receive_response(fd_rmpp_usrid, mi, &imad, buffer, bufferLength, cb, context); @@ -2368,7 +2380,11 @@ if3_dbsync_send_mad(IBhandle_t fd, SA_MAD *psa, uint32_t dataLength, uint8_t *bu } // setup RMPP related fields - (void)if3_set_rmpp_minfo(mi); + rc = if3_set_rmpp_minfo(mi); + if (rc) { + IB_EXIT(__func__, rc); + return rc; + } // // calculating Response Timeout Period @@ -2508,38 +2524,41 @@ if3_dbsync_send_mad(IBhandle_t fd, SA_MAD *psa, uint32_t dataLength, uint8_t *bu // send DB Sync single MAD request to the remote STL SM if (VSTATUS_OK != (rc = rmpp_send_request(&mad, dbsync_cntxt))) { IB_LOG_ERROR_FMT(__func__, "Failed to send RMPP DB Sync request to remote SM: rc %d", rc); - } else while(1) { - uint32_t tmpLength = *bufferLength; - + } else { // release context for DB Sync single MAD request rmpp_cntxt_full_release(dbsync_cntxt); - - // wait for response from the remote STL SM - rc = rmpp_receive_response(fd_rmpp_usrid, mi, &imad, buffer, &tmpLength, cb, context); - if (if3DebugRmpp) { - if (rc == VSTATUS_OK) { - IB_LOG_INFINI_INFO_FMT(__func__, "Data received OK, len %d", tmpLength); - } else { - IB_LOG_INFINI_INFO_FMT(__func__, "Data received FAILED, rc %d", rc); + dbsync_cntxt = NULL; + + while (1) { + uint32_t tmpLength = *bufferLength; + + // wait for response from the remote STL SM + rc = rmpp_receive_response(fd_rmpp_usrid, mi, &imad, buffer, &tmpLength, cb, context); + if (if3DebugRmpp) { + if (rc == VSTATUS_OK) { + IB_LOG_INFINI_INFO_FMT(__func__, "Data received OK, len %d", tmpLength); + } else { + IB_LOG_INFINI_INFO_FMT(__func__, "Data received FAILED, rc %d", rc); + } } + + // no writer thread was implemented for DB Synch, like it was for the SA, + // PM, PA, and FE. The writer thread would normally handle the filtering + // and processing of ACK responses. DB synch main is the reader/writer thread, + // so process the ACKs for the Slave here. + (void)BSWAPCOPY_STL_SA_MAD((STL_SA_MAD *)imad.data, &samad, STL_SA_DATA_LEN); + if (!rc && samad.header.rmppType == RMPP_TYPE_ACK) { + if (if3DebugRmpp) + IB_LOG_INFINI_INFO_FMT(__func__, "Got ACK packet"); + continue; + } + + *bufferLength = tmpLength; + // get MAD status from the header + *madRc = imad.base.status; + break; } - - // no writer thread was implemented for DB Synch, like it was for the SA, - // PM, PA, and FE. The writer thread would normally handle the filtering - // and processing of ACK responses. DB synch main is the reader/writer thread, - // so process the ACKs for the Slave here. - (void)BSWAPCOPY_STL_SA_MAD((STL_SA_MAD*)imad.data, &samad, STL_SA_DATA_LEN); - if (!rc && samad.header.rmppType == RMPP_TYPE_ACK) { - if (if3DebugRmpp) - IB_LOG_INFINI_INFO_FMT(__func__, "Got ACK packet"); - continue; - } - - *bufferLength = tmpLength; - // get MAD status from the header - *madRc = imad.base.status; - break; - } + } } bail: @@ -2573,7 +2592,7 @@ if3_dbsync_send_multi_mad (IBhandle_t fd, SA_MAD *psa, Mai_t mad; uint64_t timeout; rmpp_cntxt_t *dbsync_cntxt = NULL; - uint32_t attribOffset; + uint16_t attribOffset; uint8_t processMad = 0, omethod; int fd_rmpp_usrid = -1; SA_MAD_HDR saHdr; @@ -2596,7 +2615,11 @@ if3_dbsync_send_multi_mad (IBhandle_t fd, SA_MAD *psa, } // setup RMPP related fields - (void)if3_set_rmpp_minfo(mi); + rc = if3_set_rmpp_minfo(mi); + if (rc) { + IB_EXIT(__func__, rc); + return rc; + } // // calculating Response Timeout Period @@ -2726,12 +2749,17 @@ if3_dbsync_send_multi_mad (IBhandle_t fd, SA_MAD *psa, // before sending the MAD request, perform any required pre-processing of // the RMPP context and MAD request if (!(rc = rmpp_pre_process_request(fd_rmpp_usrid, &mad, dbsync_cntxt))) { - attribOffset = dataLength + Calculate_Padding(dataLength); + uint32_t paddedDataLength; + + // since data to be sent exceeds maximum MAD payload size, set + // attribute offset base on MAD payload size + attribOffset = sizeof(mad.data) + Calculate_Padding(sizeof(mad.data)); // setup attribute offset for RMPP transfer dbsync_cntxt->attribLen = attribOffset; + paddedDataLength = dataLength + Calculate_Padding(dataLength); // allocate RMPP request context structure - rmpp_cntxt_data(fd_rmpp_usrid, dbsync_cntxt, dataBuffer, attribOffset); + rmpp_cntxt_data(fd_rmpp_usrid, dbsync_cntxt, dataBuffer, paddedDataLength); uint32_t tmpLength; send: // send DB Sync request to the remote STL SM @@ -2821,7 +2849,11 @@ if3_dbsync_cmd_from_mngr (IBhandle_t fd, Mai_t *maip, uint8_t *buffer, uint32_t } // setup RMPP related fields - (void)if3_set_rmpp_minfo(mi); + rc = if3_set_rmpp_minfo(mi); + if (rc) { + IB_EXIT(__func__, rc); + return rc; + } // drain stale data from response handle DRAIN_MAI_STALE(mi->fds); diff --git a/Esm/ib/src/if3/if3_def.h b/Esm/ib/src/if3/if3_def.h index ff398a82..79ff76bb 100755 --- a/Esm/ib/src/if3/if3_def.h +++ b/Esm/ib/src/if3/if3_def.h @@ -114,7 +114,7 @@ Status_t if3_mngr_get_port_guid(ManagerInfo_t * fp); Status_t if3_mngr_reg_service(IBhandle_t fd, uint8_t * servName, uint64_t servID); Status_t if3_mngr_del_service(IBhandle_t fd, uint8_t * servName, uint64_t servID, uint32_t mode); Status_t if3_mngr_query_service(IBhandle_t fd, uint8_t * servName, uint64_t servID, uint32_t mode, IB_SERVICE_RECORD * serviceFoundp, uint32_t * count); -Status_t if3_mngr_query_srv_path(IBhandle_t fd, IB_SERVICE_RECORD * srp, Lid_t * lid, uint16_t * sl); +Status_t if3_mngr_query_srv_path(IBhandle_t fd, IB_SERVICE_RECORD * srp, STL_LID * lid, uint16_t * sl); Status_t if3_mngr_register_sa(IBhandle_t fd, uint8_t *servName, uint64_t servID, uint32_t option); Status_t if3_mngr_deregister_sa(IBhandle_t fd); diff --git a/Esm/ib/src/if3/rmpp.c b/Esm/ib/src/if3/rmpp.c index f27fca0e..04f960cb 100755 --- a/Esm/ib/src/if3/rmpp.c +++ b/Esm/ib/src/if3/rmpp.c @@ -63,7 +63,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. extern uint32_t if3DebugRmpp; extern int smValidateGsiMadPKey(Mai_t *maip, uint8_t mgmntAllowedRequired, uint8_t antiSpoof); -extern void if3_set_rmpp_minfo(ManagerInfo_t *mi); +extern Status_t if3_set_rmpp_minfo(ManagerInfo_t *mi); #if defined(__VXWORKS__) #define RMPP_STACK_SIZE (24 * 1024) @@ -1435,7 +1435,7 @@ cntxt_get(rmpp_user_info_t *info, Mai_t *mad, void **context) int bucket; Status_t status; rmpp_cntxt_t *rmpp_cntxt; - rmpp_context_get_t getStatus = 0; + rmpp_context_get_t getStatus = ContextNotAvailable; rmpp_cntxt_t *req_cntxt = NULL; IB_ENTER(__func__, mad, 0, 0, 0); @@ -1720,9 +1720,6 @@ static void rmpp_delete_user(rmpp_user_info_t *info) memset(info, 0, sizeof(rmpp_user_info_t)); info->inuse = 0; rmpp_userCount--; - // no active user, later re-initialize global variables - if (rmpp_userCount <= 0) - rmpp_initialized = 0; vs_unlock(&rmpp_user_lock); } } @@ -1945,6 +1942,7 @@ rmpp_mngr_open_cnx( // reset necessary global variables rmpp_initialized = 1; + rmpp_userCount = 0; memset(&rmpp_users, 0, sizeof(rmpp_users)); } if (!fd) { @@ -2066,10 +2064,10 @@ rmpp_mngr_close_cnx(ManagerInfo_t *mi, uint8_t complete) if (mi) { // setup RMPP related fields - (void)if3_set_rmpp_minfo(mi); - - if (mi->rmppMngrfd && ((usrId = rmpp_is_cnx_open(mi->rmppMngrfd)) != -1)) - (void)rmpp_close_cnx(usrId, complete); + if (!if3_set_rmpp_minfo(mi)) { + if (mi->rmppMngrfd && ((usrId = rmpp_is_cnx_open(mi->rmppMngrfd)) != -1)) + (void)rmpp_close_cnx(usrId, complete); + } } } @@ -2323,6 +2321,7 @@ rmpp_cntxt_get(int usrId, Mai_t *mad, uint8_t *processMad) IB_ENTER(__func__, mad, processMad, 0, 0); if (mad == NULL || processMad == NULL) { + IB_LOG_ERROR_FMT(__func__, "NULL parameter specified!"); IB_EXIT(__func__, rmpp_cntxt); return rmpp_cntxt; } else if (!info) { @@ -2910,6 +2909,8 @@ rmpp_receive_response(int usrId, ManagerInfo_t *mi, Mai_t *maip, uint8_t *buffer mi->timeout = timeout; while (1) { + rmpp_cntxt = NULL; + // attempt to receive response from manager status = if3_recv(mi, &mad, timeout); if (status != VSTATUS_OK) { diff --git a/Esm/ib/src/if3/service.c b/Esm/ib/src/if3/service.c index 1186c1a3..99b28561 100755 --- a/Esm/ib/src/if3/service.c +++ b/Esm/ib/src/if3/service.c @@ -453,7 +453,7 @@ if3_mngr_query_service (IBhandle_t fd, } Status_t -if3_mngr_query_srv_path(IBhandle_t fd, IB_SERVICE_RECORD *srp, Lid_t *lid , uint16_t *sl) +if3_mngr_query_srv_path(IBhandle_t fd, IB_SERVICE_RECORD *srp, STL_LID *lid , uint16_t *sl) { Status_t status; IB_PATH_RECORD pr; diff --git a/Esm/ib/src/linux/startup/Makefile b/Esm/ib/src/linux/startup/Makefile index b2d9d01b..ed8e16ea 100644 --- a/Esm/ib/src/linux/startup/Makefile +++ b/Esm/ib/src/linux/startup/Makefile @@ -113,8 +113,8 @@ INCLUDE_SUBDIR = #LOCAL_LIB_DIRS = User library directories for libpaths [Empty] CLOCAL = $(CPIE) -LOCALDEPLIBS = cs ibaccess public config vslogu Xml expat Md5 opamgt-priv -LOCALLIBS = pthread $(OPENIB_USER_LIBS) rt +LOCALDEPLIBS = cs ibaccess public config vslogu Xml expat opamgt-priv +LOCALLIBS = pthread $(OPENIB_USER_LIBS) rt crypto # Include Make Rules definitions and rules include $(PROJ_SM_DIR)/Makerules.module diff --git a/Esm/ib/src/linux/startup/fm_config/Makefile b/Esm/ib/src/linux/startup/fm_config/Makefile index 88df18ca..28a0f0f8 100644 --- a/Esm/ib/src/linux/startup/fm_config/Makefile +++ b/Esm/ib/src/linux/startup/fm_config/Makefile @@ -112,8 +112,8 @@ INCLUDE_SUBDIR = #LOCAL_LIB_DIRS = User library directories for libpaths [Empty] CLOCAL = $(CPIE) -LOCALDEPLIBS = cs ibaccess config public vslogu Xml Md5 -LOCALLIBS = rt +LOCALDEPLIBS = cs ibaccess config public vslogu Xml +LOCALLIBS = rt crypto ifneq "$(BUILD_TARGET_OS)" "VXWORKS" LOCALLIBS+= expat diff --git a/Esm/ib/src/linux/startup/fm_config/config_check.c b/Esm/ib/src/linux/startup/fm_config/config_check.c index 129bc6fa..c3292036 100644 --- a/Esm/ib/src/linux/startup/fm_config/config_check.c +++ b/Esm/ib/src/linux/startup/fm_config/config_check.c @@ -475,8 +475,6 @@ print_checksum_information (int num_instances, VirtualFabrics_t **vf_configs) { fprintf(stdout,"FM instance %u\n", i); fprintf(stdout, " SM overall checksum %8u consistency checksum %8u\n", smp->overall_checksum, smp->consistency_checksum); fprintf(stdout, " PM overall checksum %8u consistency checksum %8u\n", pmp->overall_checksum, pmp->consistency_checksum); - fprintf(stdout, " FE overall checksum %8u consistency checksum %8u\n", fep->overall_checksum, fep->consistency_checksum); - fprintf(stdout, " VF database consistency checksum %8u\n", vf_configs[i]->consistency_checksum); for (v = 0; v < vf_configs[i]->number_of_vfs; v++) fprintf(stdout, " VF %s consistency checksum %8u\n", vf_configs[i]->v_fabric[v].name, vf_configs[i]->v_fabric[v].consistency_checksum); diff --git a/Esm/ib/src/linux/startup/opafm_src.xml b/Esm/ib/src/linux/startup/opafm_src.xml index 47beb1f0..bebdb408 100644 --- a/Esm/ib/src/linux/startup/opafm_src.xml +++ b/Esm/ib/src/linux/startup/opafm_src.xml @@ -506,12 +506,11 @@ - + - - + @@ -1657,6 +1656,12 @@ 0 + + + + + 1 + 2 @@ -1673,19 +1678,28 @@ 300 0 + - + + + + + + + + 3 250 - - - - - - - 35 + + + + + + + 300 + diff --git a/Esm/ib/src/linux/startup/opafmd.c b/Esm/ib/src/linux/startup/opafmd.c index 6b03b08b..429dc8c6 100644 --- a/Esm/ib/src/linux/startup/opafmd.c +++ b/Esm/ib/src/linux/startup/opafmd.c @@ -418,9 +418,9 @@ int parseInput(char *buf){ fprintf(stderr, "Unknown component value.\n"); } } else if(strncmp(token, "sig_hup", 7) == 0){ + reloadSMs(); loadConfig(); updateInstances(); - reloadSMs(); } else if(strncmp(token, "restart", 7) == 0){ token = strtok(NULL, " "); if(token == NULL){ @@ -540,11 +540,11 @@ int pkill(const unsigned int instance, const int component){ if(!pid) return 0; if(kill(pid, 0) == 0){ kill(pid, SIGTERM); // Here we send a SIGTERM to the PID specified. - sleep(component == SM_COMPONENT ? 3 : 1); // Wait 3 seconds for SM to die from SIGTERM, only 1 sec for FE + sleep(component == SM_COMPONENT ? 3 : 5); // Wait 3 seconds for SM to die from SIGTERM, 5 sec for FE ret = waitpid((pid_t)pid, &status, WUNTRACED | WNOHANG); // Reap the children if they're already dead. Because zombies are bad, mmkay. if(!ret){ // Checks for insubordinate children kill(pid, SIGKILL); // Order a hit on them - sleep(component == SM_COMPONENT ? 3 : 1); // Allow 1-3 seconds for murder + sleep(component == SM_COMPONENT ? 3 : 5); // Allow 1-5 seconds for murder ret = waitpid((pid_t)pid, &status, WUNTRACED | WNOHANG); // Reap if(!ret){ // Report all survivors fprintf(stderr, "Failed to kill %s from instance %d\n", componentToString(component), instance); diff --git a/Esm/ib/src/mai/mai.c b/Esm/ib/src/mai/mai.c index 262187e3..b92b652d 100755 --- a/Esm/ib/src/mai/mai.c +++ b/Esm/ib/src/mai/mai.c @@ -51,8 +51,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "mai_l.h" /* Local mai function definitions */ #include "ib_macros.h" -#include "iba/stl_sm.h" -#include "iba/stl_sa.h" +#include "iba/stl_sm_priv.h" +#include "iba/stl_sa_priv.h" #ifdef __VXWORKS__ extern uint16_t getDefaultPKey(void); diff --git a/Esm/ib/src/mai/mai_config.c b/Esm/ib/src/mai/mai_config.c index 8f84cfb9..4cc6accd 100755 --- a/Esm/ib/src/mai/mai_config.c +++ b/Esm/ib/src/mai/mai_config.c @@ -68,8 +68,7 @@ int gMAI_FILT_CNT, gMAI_MAD_CNT, gMAI_HDL_CNT; -MLock_t gmai_uplock, - gmai_tidlock; +MLock_t gmai_uplock; MLock_t gmai_hlock, gmai_mlock, gmai_flock; @@ -248,7 +247,6 @@ mai_init() (void)memset(&gmai_hlock, 0, sizeof(MLock_t)); (void)memset(&gmai_flock, 0, sizeof(MLock_t)); (void)memset(&gmai_mlock, 0, sizeof(MLock_t)); - (void)memset(&gmai_tidlock, 0, sizeof(MLock_t)); (void)memset(&gmai_dcthr_lock, 0, sizeof(MLock_t)); rc = vs_lock_init(&gmai_uplock.lock, VLOCK_FREE, VLOCK_THREAD); @@ -283,14 +281,6 @@ mai_init() return; } - rc = vs_lock_init(&gmai_tidlock.lock, VLOCK_FREE, VLOCK_THREAD); - if (rc) - { - IB_LOG_ERRORRC("vs_lock_init rc:", rc); - IB_EXIT(__func__, VSTATUS_BAD); - return; - } - rc = vs_lock_init(&gmai_dcthr_lock.lock, VLOCK_FREE, VLOCK_THREAD); if (rc) { @@ -553,7 +543,6 @@ void mai_deinit(){ int i=0; vs_lock_delete(&gmai_uplock.lock); - vs_lock_delete(&gmai_tidlock.lock); vs_lock_delete(&gmai_hlock.lock); vs_lock_delete(&gmai_mlock.lock); vs_lock_delete(&gmai_flock.lock); diff --git a/Esm/ib/src/mai/mai_l.h b/Esm/ib/src/mai/mai_l.h index f1a81444..1d520122 100755 --- a/Esm/ib/src/mai/mai_l.h +++ b/Esm/ib/src/mai/mai_l.h @@ -456,8 +456,8 @@ extern int gMAI_INITIALIZED, gMAI_MAD_CNT, gMAI_HDL_CNT; -extern MLock_t gmai_uplock, - gmai_tidlock; +extern MLock_t gmai_uplock; + extern MLock_t gmai_hlock, gmai_flock, gmai_mlock; @@ -561,9 +561,6 @@ extern uint32_t gMAI_MADS_LOWWM; #define MAI_GHANDLES_LOCK() MAI_LOCK((&gmai_hlock)) #define MAI_GHANDLES_UNLOCK() MAI_UNLOCK((&gmai_hlock)) -#define MAI_TID_LOCK() MAI_LOCK((&gmai_tidlock)) -#define MAI_TID_UNLOCK() MAI_UNLOCK((&gmai_tidlock)) - #define MAI_DCTHR_LOCK() MAI_LOCK((&gmai_dcthr_lock)) #define MAI_DCTHR_UNLOCK() MAI_UNLOCK((&gmai_dcthr_lock)) diff --git a/Esm/ib/src/mai/mai_tid.c b/Esm/ib/src/mai/mai_tid.c index 1b6c094e..042c16b5 100755 --- a/Esm/ib/src/mai/mai_tid.c +++ b/Esm/ib/src/mai/mai_tid.c @@ -48,6 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "mai_l.h" /* Local mai function definitions */ +#include "ispinlock.h" /* * FUNCTION @@ -69,21 +70,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * NAME DATE REMARKS * PAW 06/4/01 Initial entry */ -static uint16_t layer_counter=0; +static ATOMIC_UINT layer_counter=0; Status_t mai_alloc_tid(IBhandle_t fd, uint8_t mclass, uint64_t * tid) { - int rc; - Threadname_t pid; - uint64_t mc = mclass, - mpid, - counter; - uint64_t llfd = (uint64_t)fd; - - /* - * Standard entry stuff - */ + int rc = 0; + ATOMIC_UINT counter = AtomicIncrement(&layer_counter); IB_ENTER(__func__, fd, 0, 0, 0); @@ -94,33 +87,23 @@ mai_alloc_tid(IBhandle_t fd, uint8_t mclass, uint64_t * tid) return rc; } - if ((rc = vs_thread_name(&pid)) != VSTATUS_OK) - { - IB_EXIT(__func__, rc); - return (rc); - } - - mpid = (uint64_t) pid; - - /* - * if first call do this computation. Avoid races by taking lock - */ - MAI_TID_LOCK(); - counter = layer_counter++; - mc = mc << 56; - llfd = llfd << 48; - MAI_TID_UNLOCK(); #if defined(CAL_IBACCESS) + // For the embedded SM, inject the process ID into the TID + // to ensure responses are delivered to the correct destination. + Threadname_t pid; + if ((rc = vs_thread_name(&pid)) != VSTATUS_OK) { + IB_EXIT(__func__, rc); + return (rc); + } + uint64_t mpid = (uint64_t) pid; *tid = (((mpid & 0xffffff) << 40) | // 24 bits for pid ((counter & 0xffff) << 24));// 16 bits for counter #elif defined(IB_STACK_OPENIB) - *tid = (((mpid & 0xffff) << 16) | // 16 bits for pid - (counter & 0xffff)); // 16 bits for counter + // OpenIB reserves the top 32 bits of the TID for its own use. + // (See infiniband/core/user_mad.c.) + *tid = (counter & 0xffffffff); // 32 bits for counter #else - /* Agilent based products */ - *tid = (mc | llfd | // upper 16 bits for class - ((mpid & 0xffff) << 32) | // 16 bits for pid - (counter)); // 32 bits for counter +#error Either CAL_IBACCESS or IB_STACK_OPENIB must be defined. #endif IB_EXIT(__func__, rc); @@ -140,16 +123,13 @@ mai_alloc_tid(IBhandle_t fd, uint8_t mclass, uint64_t * tid) uint64_t mai_increment_tid(uint64_t tid) { - uint64_t counter; - MAI_TID_LOCK(); - counter = layer_counter++; - MAI_TID_UNLOCK(); + ATOMIC_UINT counter = AtomicIncrement(&layer_counter); + #if defined(CAL_IBACCESS) return (tid & 0xffffff0000ffffffULL) | ((counter & 0xffff) << 24); #elif defined(IB_STACK_OPENIB) - return (tid & 0xffffffffffff0000ULL) | (counter & 0xffff); + return (tid & 0xffffffff00000000ULL) | (counter & 0xffffffff); #else - /* Agilent based products */ - return (tid & 0xffffffffffff0000ULL) | (counter & 0xffff); +#error Either CAL_IBACCESS or IB_STACK_OPENIB must be defined. #endif } diff --git a/Esm/ib/src/pm/pm/paAccess.c b/Esm/ib/src/pm/pm/paAccess.c index 070fb97d..a180ea93 100644 --- a/Esm/ib/src/pm/pm/paAccess.c +++ b/Esm/ib/src/pm/pm/paAccess.c @@ -31,9 +31,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "pm_topology.h" #include "paAccess.h" -#include "iba/stl_pa.h" +#include "iba/stl_pa_priv.h" #include "fm_xml.h" -//#include #include #include #ifndef __VXWORKS__ diff --git a/Esm/ib/src/pm/pm/paAccess.h b/Esm/ib/src/pm/pm/paAccess.h index 8d3e93f6..b732247c 100644 --- a/Esm/ib/src/pm/pm/paAccess.h +++ b/Esm/ib/src/pm/pm/paAccess.h @@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define _GNU_SOURCE #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/Esm/ib/src/pm/pm/paServer.c b/Esm/ib/src/pm/pm/paServer.c index 57b2011b..588e7521 100644 --- a/Esm/ib/src/pm/pm/paServer.c +++ b/Esm/ib/src/pm/pm/paServer.c @@ -32,8 +32,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "pm_l.h" #include "pa_l.h" #include "iba/stl_pm.h" -#include "iba/stl_mad.h" -#include "iba/stl_pa.h" +#include "iba/stl_mad_priv.h" +#include "iba/stl_pa_priv.h" #include #include "pm_topology.h" #include "paAccess.h" diff --git a/Esm/ib/src/pm/pm/pa_protocol.c b/Esm/ib/src/pm/pm/pa_protocol.c index 433c35f7..f2312d63 100755 --- a/Esm/ib/src/pm/pm/pa_protocol.c +++ b/Esm/ib/src/pm/pm/pa_protocol.c @@ -43,8 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "vfi_g.h" #include "pm_l.h" #include "pm_counters.h" -#include "iba/ib_pa.h" -#include "iba/stl_pa.h" +#include "iba/stl_pa_priv.h" #include "paServer.h" #include "fm_xml.h" @@ -185,22 +184,6 @@ static pa_cntxt_t *pa_cntxt_free_list; static Lock_t pa_cntxt_lock; static pa_cntxt_t *pa_hash[PA_CNTXT_HASH_TABLE_DEPTH]; -// TBD - template_* not used -static uint16_t patemplate_type; -static uint32_t patemplate_length; -static FieldMask_t *patemplate_fieldp; - -static FieldMask_t PaRecordFieldMask[] = { - { 0, 64 }, - { 0, 0 }, -}; - -static FieldMask_t PaTableRecordFieldMask[] = { - { 0, 64 }, - { 64, 512}, - { 0, 0 }, -}; - static void pa_main_writer(uint32_t argc, uint8_t ** argv); @@ -288,38 +271,6 @@ pa_getMethodText(int method) } } -// TBD - template_* not used -static Status_t -pa_data_offset(uint16_t type) -{ - - IB_ENTER(__func__, type, 0, 0, 0); - - patemplate_type = type; - patemplate_fieldp = NULL; - - // create the mask for the comparisons. - switch (type) { - case STL_PA_CMD_GET: - case STL_PA_CMD_SET: - patemplate_length = PA_RECORD_NSIZE; - patemplate_fieldp = PaRecordFieldMask; - break; - case STL_PA_CMD_GETTABLE: - patemplate_length = PA_TABLE_RECORD_NSIZE; - patemplate_fieldp = PaTableRecordFieldMask; - break; - } - - if (patemplate_fieldp != NULL) { - IB_EXIT(__func__, VSTATUS_OK); - return(VSTATUS_OK); - } else { - IB_EXIT(__func__, VSTATUS_BAD); - return(VSTATUS_BAD); - } -} - static Status_t pa_cntxt_free_data(pa_cntxt_t *cntxt) { @@ -347,8 +298,8 @@ pa_validate_mad(Mai_t *maip) } else { // drop unsupported MADs switch (maip->base.method) { - case PA_CMD_GET_RESP: - case PA_CMD_GETTABLE_RESP: + case STL_PA_CMD_GET_RESP: + case STL_PA_CMD_GETTABLE_RESP: if (pm_config.debug_rmpp) { IB_LOG_INFINI_INFO_FMT(__func__, "Unsupported or invalid %s[%s] request from LID [0x%x], TID["FMT_U64"]", @@ -1269,7 +1220,7 @@ pa_writer_filter(Mai_t *maip) return 1; // indicate that no match has been found // the pa writer thread is only responsible for in flight rmpp packets - if (maip->base.method == PA_CMD_GETTABLE || maip->base.method == (PA_CMD_GETTABLE_RESP ^ MAD_PA_REPLY)) + if (maip->base.method == STL_PA_CMD_GETTABLE) { // check for inflight rmpp BSWAPCOPY_STL_SA_MAD_HEADER((STL_SA_MAD_HEADER*) (maip->data), &pamad); @@ -1537,23 +1488,20 @@ pa_process_mad(Mai_t *maip, pa_cntxt_t* pa_cntxt) /* get network Mad into structure */ BSWAPCOPY_STL_SA_MAD((STL_SA_MAD*) (maip->data), &pamad, STL_SA_DATA_LEN); - - // process specific command request. - (void)pa_data_offset(maip->base.method); switch (maip->base.method) { case STL_PA_CMD_SET: - if (maip->base.aid == PA_ATTRID_CLR_PORT_CTRS) { + if (maip->base.aid == STL_PA_ATTRID_CLR_PORT_CTRS) { (void)pa_clrPortCountersResp(maip, pa_cntxt); - } else if (maip->base.aid == PA_ATTRID_CLR_ALL_PORT_CTRS) { + } else if (maip->base.aid == STL_PA_ATTRID_CLR_ALL_PORT_CTRS) { (void)pa_clrAllPortCountersResp(maip, pa_cntxt); - } else if (maip->base.aid == PA_ATTRID_FREEZE_IMAGE) { + } else if (maip->base.aid == STL_PA_ATTRID_FREEZE_IMAGE) { (void)pa_freezeImageResp(maip, pa_cntxt); - } else if (maip->base.aid == PA_ATTRID_RELEASE_IMAGE) { + } else if (maip->base.aid == STL_PA_ATTRID_RELEASE_IMAGE) { (void)pa_releaseImageResp(maip, pa_cntxt); - } else if (maip->base.aid == PA_ATTRID_RENEW_IMAGE) { + } else if (maip->base.aid == STL_PA_ATTRID_RENEW_IMAGE) { (void)pa_renewImageResp(maip, pa_cntxt); - } else if (maip->base.aid == PA_ATTRID_MOVE_FREEZE_FRAME) { + } else if (maip->base.aid == STL_PA_ATTRID_MOVE_FREEZE_FRAME) { (void)pa_moveFreezeImageResp(maip, pa_cntxt); } else if (maip->base.aid == STL_PA_ATTRID_CLR_VF_PORT_CTRS) { (void)pa_clrVFPortCountersResp(maip, pa_cntxt); @@ -1565,9 +1513,9 @@ pa_process_mad(Mai_t *maip, pa_cntxt_t* pa_cntxt) case STL_PA_CMD_GET: if (maip->base.aid == STL_PA_ATTRID_GET_CLASSPORTINFO) { (void)pa_getClassPortInfoResp(maip, pa_cntxt); - } else if (maip->base.aid == PA_ATTRID_GET_PORT_CTRS) { + } else if (maip->base.aid == STL_PA_ATTRID_GET_PORT_CTRS) { (void)pa_getPortCountersResp(maip, pa_cntxt); - } else if (maip->base.aid == PA_ATTRID_GET_PM_CONFIG) { + } else if (maip->base.aid == STL_PA_ATTRID_GET_PM_CONFIG) { (void)pa_getPmConfigResp(maip, pa_cntxt); } else if (maip->base.aid == STL_PA_ATTRID_GET_VF_PORT_CTRS) { (void)pa_getVFPortCountersResp(maip, pa_cntxt); @@ -1583,9 +1531,9 @@ pa_process_mad(Mai_t *maip, pa_cntxt_t* pa_cntxt) (void)pa_getGroupInfoResp(maip, pa_cntxt); } else if (maip->base.aid == STL_PA_ATTRID_GET_GRP_CFG) { (void)pa_getGroupConfigResp(maip, pa_cntxt); - } else if (maip->base.aid == PA_ATTRID_GET_FOCUS_PORTS) { + } else if (maip->base.aid == STL_PA_ATTRID_GET_FOCUS_PORTS) { (void)pa_getFocusPortsResp(maip, pa_cntxt); - } else if (maip->base.aid == PA_ATTRID_GET_IMAGE_INFO) { + } else if (maip->base.aid == STL_PA_ATTRID_GET_IMAGE_INFO) { (void)pa_getImageInfoResp(maip, pa_cntxt); } else if (maip->base.aid == STL_PA_ATTRID_GET_VF_LIST) { (void)pa_getVFListResp(maip, pa_cntxt); @@ -1612,7 +1560,7 @@ pa_process_mad(Mai_t *maip, pa_cntxt_t* pa_cntxt) } // switch to pa writer mai handle for sending out remainder of rmpp responses - if (pa_cntxt->method == PA_CMD_GETTABLE) { + if (pa_cntxt->method == STL_PA_CMD_GETTABLE) { pa_cntxt->sendFd = fd_pa_w; } diff --git a/Esm/ib/src/pm/pm/pm.c b/Esm/ib/src/pm/pm/pm.c index 41e890a2..2cdd56cc 100755 --- a/Esm/ib/src/pm/pm/pm.c +++ b/Esm/ib/src/pm/pm/pm.c @@ -51,8 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "sm_l.h" #include "sm_dbsync.h" #include "pm_topology.h" -#include "iba/ib_pa.h" -#include "iba/stl_pa.h" +#include "iba/stl_pa_priv.h" #ifdef __LINUX__ #define static @@ -379,9 +378,9 @@ Status_t doRegisterPM(uint8_t masterPm) uint32_t rc; uint64_t lease; uint16_t flags; - uint8_t pmState = (masterPm) ? PM_MASTER : PM_STANDBY; - uint64_t pmSrvId = (masterPm) ? PM_SERVICE_ID : PM_SERVICE_ID_SEC; - char *pmSrvNm = (masterPm) ? PM_SERVICE_NAME : PM_SERVICE_NAME_SEC; + uint8_t pmState = (masterPm) ? STL_PM_MASTER : STL_PM_STANDBY; + uint64_t pmSrvId = (masterPm) ? STL_PM_SERVICE_ID : STL_PM_SERVICE_ID_SEC; + char *pmSrvNm = (masterPm) ? STL_PM_SERVICE_NAME : STL_PM_SERVICE_NAME_SEC; lease = 2 * pm_interval; @@ -391,7 +390,7 @@ Status_t doRegisterPM(uint8_t masterPm) vs_unlock(&smRecords.smLock); BuildRecord(&pmServRer, (void *)pmSrvNm, pmSrvId, flags, lease, - PmEngineRunning() ? PM_VERSION : 0, + PmEngineRunning() ? STL_PM_VERSION : 0, PmEngineRunning() ? pmState : 0); rc = vfi_mngr_register(pm_fd, vfi_mclass, VFI_DEFAULT_GUID, &pmServRer, VFI_SVRREC_GID | VFI_SVREC_NAME | VFI_SVRREC_ID, VFI_REGFORCE_FABRIC); @@ -429,7 +428,7 @@ registerPM(void) memset((void *)&pmServRer, 0, sizeof(pmServRer)); memset((void *)&pathr[0], 0, sizeof(pathr)); - BuildRecord(&pmServRer, (void *)PM_SERVICE_NAME, PM_SERVICE_ID, flags, lease, PM_VERSION, PM_MASTER); + BuildRecord(&pmServRer, (void *)STL_PM_SERVICE_NAME, STL_PM_SERVICE_ID, flags, lease, STL_PM_VERSION, STL_PM_MASTER); rc = vfi_mngr_find_cmp(pm_fd, vfi_mclass, VFI_LMC_BASELID, &pmServRer, @@ -931,20 +930,20 @@ pm_main() "Received cmd 0x%.8x insize %d", cmd, insize); switch (cmd) { - case PA_ATTRID_GET_CLASSPORTINFO: - case PA_ATTRID_GET_GRP_CFG: - case PA_ATTRID_GET_GRP_INFO: - case PA_ATTRID_GET_GRP_LIST: - case PA_ATTRID_GET_PORT_CTRS: - case PA_ATTRID_CLR_PORT_CTRS: - case PA_ATTRID_CLR_ALL_PORT_CTRS: - case PA_ATTRID_GET_PM_CONFIG: - case PA_ATTRID_FREEZE_IMAGE: - case PA_ATTRID_RELEASE_IMAGE: - case PA_ATTRID_RENEW_IMAGE: - case PA_ATTRID_GET_FOCUS_PORTS: - case PA_ATTRID_GET_IMAGE_INFO: - case PA_ATTRID_MOVE_FREEZE_FRAME: + case STL_PA_ATTRID_GET_CLASSPORTINFO: + case STL_PA_ATTRID_GET_GRP_CFG: + case STL_PA_ATTRID_GET_GRP_INFO: + case STL_PA_ATTRID_GET_GRP_LIST: + case STL_PA_ATTRID_GET_PORT_CTRS: + case STL_PA_ATTRID_CLR_PORT_CTRS: + case STL_PA_ATTRID_CLR_ALL_PORT_CTRS: + case STL_PA_ATTRID_GET_PM_CONFIG: + case STL_PA_ATTRID_FREEZE_IMAGE: + case STL_PA_ATTRID_RELEASE_IMAGE: + case STL_PA_ATTRID_RENEW_IMAGE: + case STL_PA_ATTRID_GET_FOCUS_PORTS: + case STL_PA_ATTRID_GET_IMAGE_INFO: + case STL_PA_ATTRID_MOVE_FREEZE_FRAME: case STL_PA_ATTRID_GET_VF_LIST: case STL_PA_ATTRID_GET_VF_INFO: case STL_PA_ATTRID_GET_VF_CONFIG: diff --git a/Esm/ib/src/pm/pm/pm_async_rcv.c b/Esm/ib/src/pm/pm/pm_async_rcv.c index 69efb112..fe73a621 100644 --- a/Esm/ib/src/pm/pm/pm_async_rcv.c +++ b/Esm/ib/src/pm/pm/pm_async_rcv.c @@ -58,11 +58,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ib_mad.h" #include "ib_status.h" #include "cs_g.h" -//#include "sm_counters.h" -//#include "sm_l.h" #include "pm_l.h" #include "cs_context.h" -//#include "cs_queue.h" #include "pm_topology.h" extern SMXmlConfig_t sm_config; diff --git a/Esm/ib/src/pm/pm/pm_calc.c b/Esm/ib/src/pm/pm/pm_calc.c index 4c765d6d..dad18f47 100644 --- a/Esm/ib/src/pm/pm/pm_calc.c +++ b/Esm/ib/src/pm/pm/pm_calc.c @@ -50,7 +50,7 @@ static void ClearUtilStats(PmUtilStats_t *utilp) utilp->MaxKPps = 0; utilp->MinKPps = IB_UINT32_MAX; - MemoryClear(&utilp->BwPorts[0], sizeof(utilp->BwPorts[0]) * PM_UTIL_BUCKETS); + MemoryClear(&utilp->BwPorts[0], sizeof(utilp->BwPorts[0]) * STL_PM_UTIL_BUCKETS); } static void ClearErrStats(PmErrStats_t *errp) diff --git a/Esm/ib/src/pm/pm/pm_counters.h b/Esm/ib/src/pm/pm/pm_counters.h index d78eb90c..3a0b6218 100644 --- a/Esm/ib/src/pm/pm/pm_counters.h +++ b/Esm/ib/src/pm/pm/pm_counters.h @@ -56,7 +56,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ib_mad.h" #include "ib_sa.h" #include "mai_g.h" -#include "iba/stl_pa.h" +#include "iba/stl_pa_priv.h" // // PM Counter Definitions @@ -239,13 +239,13 @@ void INCREMENT_PM_MAD_STATUS_COUNTERS(Mai_t * mad) { case MAD_STATUS_BAD_FIELD: INCREMENT_PM_COUNTER(pmCountersPaTxRespMadStatusBadField); break; - case MAD_STATUS_PA_UNAVAILABLE: + case STL_MAD_STATUS_STL_PA_UNAVAILABLE: INCREMENT_PM_COUNTER(pmCountersPaTxRespMadStatusPaUnavailable); break; - case MAD_STATUS_PA_NO_GROUP: + case STL_MAD_STATUS_STL_PA_NO_GROUP: INCREMENT_PM_COUNTER(pmCountersPaTxRespMadStatusPaNoGroup); break; - case MAD_STATUS_PA_NO_PORT: + case STL_MAD_STATUS_STL_PA_NO_PORT: INCREMENT_PM_COUNTER(pmCountersPaTxRespMadStatusPaNoPort); break; case STL_MAD_STATUS_STL_PA_NO_VF: diff --git a/Esm/ib/src/pm/pm/pm_dispatch.c b/Esm/ib/src/pm/pm/pm_dispatch.c index 87364a48..c5f67d2d 100644 --- a/Esm/ib/src/pm/pm/pm_dispatch.c +++ b/Esm/ib/src/pm/pm/pm_dispatch.c @@ -1033,6 +1033,8 @@ static uint8 DispatcherStartSweepAllPorts(Pm_t *pm, PmDispatcherNode_t *dispnode #endif for (slot = 0; slot < pm_config.PmaBatchSize; ) { + // reset numVLs back to 0 in case it has changed since the last PM sweep + dispnode->DispPackets[slot].numVLs = 0; status = DispatchNextPacket(pm, dispnode, &dispnode->DispPackets[slot]); switch (status) { case VSTATUS_OK: diff --git a/Esm/ib/src/pm/pm/pm_sweep.c b/Esm/ib/src/pm/pm/pm_sweep.c index ccfb7a6d..d71b9060 100644 --- a/Esm/ib/src/pm/pm/pm_sweep.c +++ b/Esm/ib/src/pm/pm/pm_sweep.c @@ -4891,7 +4891,7 @@ static void PmFinalizeAllPortStats(Pm_t *pm) do { \ if (thresholdsExceededMsgCount.stat < pm_config.thresholdsExceededMsgLimit.stat) { \ uint32 stat = compute##stat(pm, pm->SweepIndex, pmportp, NULL); \ - if (ComputeErrBucket(stat, pm->Thresholds.stat) >= (PM_ERR_BUCKETS-1)) { \ + if (ComputeErrBucket(stat, pm->Thresholds.stat) >= (STL_PM_CATEGORY_BUCKETS-1)) { \ PmPort_t *pmportp2 = pmportp->Image[pm->SweepIndex].neighbor; \ PmPrintExceededPort(pmportp, pm->SweepIndex, #stat, pm->Thresholds.stat, stat); \ PmPrintExceededPortDetails##stat(pmportp, pmportp2, pm->SweepIndex, pm->LastSweepIndex); \ diff --git a/Esm/ib/src/pm/pm/pm_topology.h b/Esm/ib/src/pm/pm/pm_topology.h index 1be19e4f..b48b50a9 100644 --- a/Esm/ib/src/pm/pm/pm_topology.h +++ b/Esm/ib/src/pm/pm/pm_topology.h @@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define _GNU_SOURCE #include #include -#include +#include #include // for ATOMIC_UINT #include // for cl_qmap_t #include @@ -257,12 +257,6 @@ typedef struct ErrorBucket_s { pm_bucket_t Routing; } PACK_SUFFIX ErrorBucket_t; -// we have 10 buckets each covering a 10% range. -// So we can say number of ports with 0-10% utilization, number with 10-20% -// ... number with 90-100% -#define PM_UTIL_GRAN_PERCENT 10 /* granularity of utilization buckets */ -#define PM_UTIL_BUCKETS (100/PM_UTIL_GRAN_PERCENT) - // summary of utilization statistics for a group of ports typedef struct PmUtilStats_s { // internal intermediate data @@ -276,7 +270,7 @@ typedef struct PmUtilStats_s { uint32 MaxMBps; // maximum MB per second of all selected ports // Counter below counts number of ports within given % of BW utilization - pm_bucket_t BwPorts[PM_UTIL_BUCKETS]; + pm_bucket_t BwPorts[STL_PM_UTIL_BUCKETS]; // packets/sec tracking uint32 AvgKPps; // average kilo packets/sec of all selected ports @@ -296,12 +290,6 @@ typedef struct PmUtilStats_s { #define PA_INC_COUNTER_NO_OVERFLOW(cntr, max) do { if (cntr >= max) { cntr = max; } else { cntr++; } } while(0) -// we have 4 buckets each covering a 25% range and one extra bucket -// So we can say number of ports within 0-24% of threshold, number within 25-50% -// ... number within 75-100% and number exceeding threshold. -#define PM_ERR_GRAN_PERCENT 25 /* granularity of error buckets */ -#define PM_ERR_BUCKETS ((100/PM_ERR_GRAN_PERCENT)+1) // extra bucket is for those over threshold - // summary of error statistics for a group of ports typedef struct PmErrStats_s { // For between-group stats, we take Max of us and our neighbor @@ -315,7 +303,7 @@ typedef struct PmErrStats_s { // for in-group we count one for each port in group // buckets are based on % of configured threshold, // last bucket is for >=100% of threshold - ErrorBucket_t Ports[PM_ERR_BUCKETS];// in group + ErrorBucket_t Ports[STL_PM_CATEGORY_BUCKETS];// in group } PACK_SUFFIX PmErrStats_t; struct PmPort_s; @@ -938,7 +926,7 @@ typedef struct Pm_s { uint32 *freezeFrames; // exclusively for FREEZE_FRAME // configuration settings - uint16 flags; // configured (see ib_pa.h pmFlags for a list) + uint16 flags; // configured (see stl_pa.h pmFlags for a list) uint16 interval; // in seconds // threshold is per interval NOT per second // set threshold to 0 to disable monitoring given Error type @@ -1003,7 +991,7 @@ BSWAP_PM_UTIL_STATS(PmUtilStats_t *Dest) Dest->AvgMBps = ntoh32(Dest->AvgMBps); Dest->MinMBps = ntoh32(Dest->MinMBps); Dest->MaxMBps = ntoh32(Dest->MaxMBps); - BSWAP_PM_BUCKET(Dest->BwPorts, PM_UTIL_BUCKETS); + BSWAP_PM_BUCKET(Dest->BwPorts, STL_PM_UTIL_BUCKETS); Dest->AvgKPps = ntoh32(Dest->AvgKPps); Dest->MinKPps = ntoh32(Dest->MinKPps); Dest->MaxKPps = ntoh32(Dest->MaxKPps); @@ -1056,7 +1044,7 @@ BSWAP_PM_ERR_STATS(PmErrStats_t *Dest) { #if CPU_LE BSWAP_PM_ERROR_SUMMARY(&Dest->Max, 1); - BSWAP_PM_ERROR_BUCKET(Dest->Ports, PM_ERR_BUCKETS); + BSWAP_PM_ERROR_BUCKET(Dest->Ports, STL_PM_CATEGORY_BUCKETS); #endif } // End of BSWAP_PM_ERR_STATS @@ -1538,9 +1526,9 @@ static __inline uint8 ComputeUtilBucket(uint32 SendMBps, uint32 maxMBps) { if (maxMBps) { // directly compute bucket to reduce overflow chances - uint8 utilBucket = (SendMBps * PM_UTIL_BUCKETS) / maxMBps; - if (utilBucket >= PM_UTIL_BUCKETS) - return PM_UTIL_BUCKETS-1; + uint8 utilBucket = (SendMBps * STL_PM_UTIL_BUCKETS) / maxMBps; + if (utilBucket >= STL_PM_UTIL_BUCKETS) + return STL_PM_UTIL_BUCKETS-1; else return utilBucket; } else { @@ -1555,9 +1543,9 @@ static __inline uint8 ComputeErrBucket(uint32 errCnt, uint32 errThreshold) uint8 errBucket; if (! errThreshold) return 0; - errBucket = (errCnt * (PM_ERR_BUCKETS-1)) / errThreshold; - if (errBucket >= PM_ERR_BUCKETS) - return PM_ERR_BUCKETS-1; + errBucket = (errCnt * (STL_PM_CATEGORY_BUCKETS-1)) / errThreshold; + if (errBucket >= STL_PM_CATEGORY_BUCKETS) + return STL_PM_CATEGORY_BUCKETS-1; else return errBucket; } diff --git a/Esm/ib/src/smi/include/sa_l.h b/Esm/ib/src/smi/include/sa_l.h index feb4ebcf..5b2dcc91 100755 --- a/Esm/ib/src/smi/include/sa_l.h +++ b/Esm/ib/src/smi/include/sa_l.h @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT2 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -175,7 +175,7 @@ typedef Status_t (*SACacheBuildFunc_t)(SACacheEntry_t *, Topology_t *); // Authentication structure. // typedef struct { - Lid_t lid; // 16 bit Lid + STL_LID lid; // 16 bit Lid Node_t *nodep; // node for this Lid Port_t *portp; // port on the node for this Lid PKey_t pKeys[SM_PKEYS]; // PKeys for comparison @@ -191,7 +191,7 @@ extern uint32_t sa_max_path_records;// maximum path records in one response typedef struct sa_cntxt { uint64_t tstamp ; uint64_t tid ; // Tid for hash table search - Lid_t lid ; // Lid for hash table search + STL_LID lid ; // Lid for hash table search uint16_t method; // initial method requested by initiator IBhandle_t sendFd; // mai handle to use for sending packets (fd_sa for 1st seg and fd_sa_w threafter) uint8_t hashed ; // Entry is inserted into the hash table @@ -350,8 +350,8 @@ extern void sa_ServiceRecDelete(void); extern void sa_ServiceRecClear(void); extern Status_t sa_McGroupInit(void); extern void sa_McGroupDelete(void); -extern Status_t sa_Authenticate_Path(Lid_t, Lid_t); -extern Status_t sa_Authenticate_Access(uint32_t, Lid_t, Lid_t, Lid_t); +extern Status_t sa_Authenticate_Path(STL_LID, STL_LID); +extern Status_t sa_Authenticate_Access(uint32_t, STL_LID, STL_LID, STL_LID); extern Status_t sa_Compare_Node_Port_PKeys(Node_t*, Port_t*); extern Status_t sa_Compare_Port_PKeys(Port_t*, Port_t*); extern uint32_t saDebugPerf; // control SA performance messages; default is off @@ -405,6 +405,7 @@ extern Status_t sa_HFICongCtrlRecord(Mai_t *, sa_cntxt_t* ); extern Status_t sa_BufferControlTableRecord(Mai_t *, sa_cntxt_t* ); extern Status_t sa_PortGroupRecord(Mai_t *, sa_cntxt_t* ); extern Status_t sa_PortGroupFwdRecord(Mai_t *, sa_cntxt_t* ); +extern Status_t sa_SwitchCostRecord(Mai_t *, sa_cntxt_t* ); extern Status_t sa_NodeRecord_BuildCACache(SACacheEntry_t *, Topology_t *); extern Status_t sa_NodeRecord_BuildSwitchCache(SACacheEntry_t *, Topology_t *); diff --git a/Esm/ib/src/smi/include/sm_counters.h b/Esm/ib/src/smi/include/sm_counters.h index d8a2ea35..89319ce0 100644 --- a/Esm/ib/src/smi/include/sm_counters.h +++ b/Esm/ib/src/smi/include/sm_counters.h @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT2 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -96,6 +96,8 @@ typedef enum _smCounters { smCounterTrapBadPKey, // Trap 257 smCounterTrapBadQKey, // Trap 258 smCounterTrapBadPKeySwPort, // Trap 259 + smCounterTrapLinkWidthDowngrade, // Trap 2048 + smCounterTrapCostMatrixChange, // Trap 2049 smCounterTrapsRepressed, smCounterGetNodeDescription, // No set @@ -247,6 +249,9 @@ typedef enum _smCounters { smCounterSaRxGetPortGroupFwdRecord, smCounterSaRxGetTblPortGroupFwdRecord, + smCounterSaRxGetSwitchCostRecord, + smCounterSaRxGetTblSwitchCostRecord, + smCounterSaRxReportResponse, // Weird conditions diff --git a/Esm/ib/src/smi/include/sm_dbsync.h b/Esm/ib/src/smi/include/sm_dbsync.h index c50c6a92..2be82921 100644 --- a/Esm/ib/src/smi/include/sm_dbsync.h +++ b/Esm/ib/src/smi/include/sm_dbsync.h @@ -171,12 +171,35 @@ typedef struct { DBSyncType_t type; /* 1=get capability, 2=full sync, 3=update, 4=delete */ DBSyncDatTyp_t datatype; /* 1=all (full sync only), 2=InformInfo, 3=groups, 4=services */ uint64_t portguid; /* portguid of standby SM */ - Lid_t standbyLid; /* lid of the standby SM */ + STL_LID standbyLid; /* lid of the standby SM */ uint8_t isEmbedded; /* 1: standby SM is embedded */ SMSyncData_t data; /* opaque data buffer to hold specific sync data */ }SMSyncReq_t; typedef SMSyncReq_t *SMSyncReqp; /* Sm Sync Request pointer type */ +// +// Multicast dbsync structure +// + +typedef struct { + uint8_t mGid[16]; + uint32_t members_full; + uint32_t qKey; + uint16_t pKey; + STL_LID mLid; + uint8_t mtu; + uint8_t rate; + uint8_t life; + uint8_t sl; + uint32_t flowLabel; + uint8_t hopLimit; + uint8_t tClass; + uint8_t scope; + uint8_t filler; + uint16_t membercount; + uint32_t index_pool; /* Next index to use for new Mc Member records */ +} McGroupSync_t; + //********** SM topology asynchronous send receive response queue ********** extern cs_Queue_ptr sm_dbsync_queue; #define SM_DBSYNC_QUEUE_SIZE 128 @@ -233,7 +256,6 @@ BSWAPCOPY_SM_DBSYNC_CCC_DATA(SMDBCCCSyncp Src, SMDBCCCSyncp Dest) Dest->smVfChecksum = ntoh32(Dest->smVfChecksum); Dest->smConfigChecksum = ntoh32(Dest->smConfigChecksum); Dest->pmConfigChecksum = ntoh32(Dest->pmConfigChecksum); - Dest->feConfigChecksum = ntoh32(Dest->feConfigChecksum); Dest->spare1 = ntoh32(Dest->spare1); Dest->spare2 = ntoh32(Dest->spare2); @@ -307,7 +329,7 @@ BSWAPCOPY_SM_DBSYNC_RECORD_CNT(uint32_t *Src, uint32_t *Dest) void sm_dbsync(uint32_t, uint8_t **); /* sm db sync main function */ Status_t sm_dbsync_filter_add(IBhandle_t fd, Filter_t *filter, uint8_t mclass, uint8_t method, uint16_t aid, uint32_t amod, uint64_t tid, const char *subRoutine); -void sm_dbsync_queueMsg(DBSyncType_t syncType, DBSyncDatTyp_t syncDataTye, Lid_t lid, Guid_t portguid, uint8_t isEmbedded, SMSyncData_t); +void sm_dbsync_queueMsg(DBSyncType_t syncType, DBSyncDatTyp_t syncDataTye, STL_LID lid, Guid_t portguid, uint8_t isEmbedded, SMSyncData_t); void sm_dbsync_addSm(Node_t *, Port_t *, STL_SMINFO_RECORD *); void sm_dbsync_deleteSm(uint64_t); void sm_dbsync_updateSm(SmRecKey_t, STL_SM_INFO *); @@ -321,7 +343,7 @@ DBSyncStat_t sm_dbsync_getSmDbsyncStat(SmRecKey_t); Status_t sm_dbsync_getSmDbsync(SmRecKey_t, SMDBSyncp); boolean sm_dbsync_isUpToDate(SmRecKey_t, char **reason); DBSyncCap_t sm_dbsync_getDbsyncSupport(SmRecKey_t); -Status_t sm_dbsync_checksums(uint32_t vfCsum, uint32_t smCsum, uint32_t pmCsum, uint32_t feCsum); +Status_t sm_dbsync_checksums(uint32_t vfCsum, uint32_t smCsum, uint32_t pmCsum); Status_t sm_dbsync_recInit(void); void sm_dbsync_kill(void); void sm_dbsync_init(void); diff --git a/Esm/ib/src/smi/include/sm_dor.h b/Esm/ib/src/smi/include/sm_dor.h index eb0981cb..a0f2e40a 100644 --- a/Esm/ib/src/smi/include/sm_dor.h +++ b/Esm/ib/src/smi/include/sm_dor.h @@ -87,6 +87,8 @@ typedef struct _DorTopology { // contiguous within these bounds int8_t coordMaximums[SM_DOR_MAX_DIMENSIONS]; int8_t coordMinimums[SM_DOR_MAX_DIMENSIONS]; + int8_t measuredMaximums[SM_DOR_MAX_DIMENSIONS]; + int8_t measuredMinimums[SM_DOR_MAX_DIMENSIONS]; // for each dimension, true if toroidal uint8_t toroidal[SM_DOR_MAX_DIMENSIONS]; // the configured number of toroidal dimensions diff --git a/Esm/ib/src/smi/include/sm_l.h b/Esm/ib/src/smi/include/sm_l.h index 584bdd98..6dd62b8d 100755 --- a/Esm/ib/src/smi/include/sm_l.h +++ b/Esm/ib/src/smi/include/sm_l.h @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT2 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -71,7 +71,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ilist.h" #include "iquickmap.h" -#include +#include #include #ifdef __VXWORKS__ @@ -229,6 +229,47 @@ typedef struct _PortDataVLArb { VlarbTableData vlarb; } PortDataVLArb; +// +// Persistent Topology API +// + +typedef enum { + POPO_QUARANTINE_NONE = 0, + POPO_QUARANTINE_SHORT = 1, +} PopoQuarantineType_t; + +typedef struct { + struct _PopoNode * ponodep; + struct { + PopoQuarantineType_t type; + LIST_ITEM entry; + } quarantine; +} PopoPort_t; + +typedef struct _PopoNode { + cl_map_item_t nodesEntry; + struct { + uint32_t pass; + uint8_t nodeType; + uint8_t numPorts; + } info; + struct { + uint8_t errorCount; + } quarantine; + PopoPort_t ports[0]; +} PopoNode_t; + +typedef struct { + Lock_t lock; + cl_qmap_t nodes; + struct { + ATOMIC_UINT cumulativeTimeout; + } errors; + struct { + QUICK_LIST shortTerm; + } quarantine; +} Popo_t; + // // Per Port structure. // @@ -351,6 +392,7 @@ typedef struct _Port { uint32_t nodeno; // node index of other end uint32_t portno; // port index of other end uint8_t path[64]; // path to get to this port + PopoPort_t *poportp; // pointer to persistent port structure PortData_t *portData; // Pointer to additional port related fields. // may be NULL when dynamic port alloc enabled // TBD - is dynamic port alloc needed? Should it @@ -408,7 +450,8 @@ typedef struct _Node { cl_map_obj_t mapObj; // Quickmap item to sort on guids cl_map_obj_t nodeIdMapObj; // Quickmap item to sort on guids cl_map_obj_t mapQuarantinedObj; // Quickmap item to sort on guids - + cl_map_obj_t switchLidMapObj; // Quickmap item to sort switch lids + PopoNode_t *ponodep; // pointer to persistent node structure void *routingData; // Routing specific data. /* There exist a case where these are both used (Enhanced SWP0 switch). We'll just @@ -430,9 +473,8 @@ typedef struct _Node { uint8_t hasSendOnlyMember:1; //switch has a multicast sendonly member attached */ uint8_t mftChange:1; // indicates if mft of switch has to be completely reprogrammed uint8_t mftPortMaskChange:1;// indicates if mft entries of switch have changed since last sweep - uint8_t arChange:1; // indicates adaptive routing tables of switch need to be programmed + uint8_t arChange:1; // indicates adaptive routing tables of switch need to be programmed, leave pause if set uint8_t arSupport:1; // indicates switch supports adaptive routing - uint8_t arDenyUnpause:1; ///< Normally 0, set to 1 to prevent unpausing AR on an SMA because the SM was not able to update PGT/PGFTs fully on the SMA uint8_t oldExists:1; // this node is also in the old topology uint8_t uniformVL:1; uint8_t internalLinks:1; @@ -878,6 +920,9 @@ typedef struct _Topology { /// Store link down reasons for ports that disappeared; /// see LdrCacheEntry_t cl_qmap_t *ldrCache; + + /// Store switch lids for efficient cost queries + cl_qmap_t * switchLids; } Topology_t; typedef struct { @@ -955,7 +1000,7 @@ typedef struct _McGroup { } McGroup_t; #if defined(__VXWORKS__) -#define SM_STACK_SIZE (24 * 1024) +#define SM_STACK_SIZE (29 * 1024) #else #define SM_STACK_SIZE (256 * 1024) #endif @@ -1046,6 +1091,7 @@ typedef struct sm_dispatch_send_params { typedef struct sm_dispatch_req { sm_dispatch_send_params_t sendParams; Node_t *nodep; + uint64_t sendTime; uint32_t sweepPasscount; struct sm_dispatch *disp; struct sm_dispatch_req *next, *prev; @@ -1145,6 +1191,7 @@ typedef enum { SM_SWEEP_REASON_INTERVAL_CHANGE, SM_SWEEP_REASON_FAILED_SWEEP, SM_SWEEP_REASON_TRAP_EVENT, + SM_SWEEP_REASON_UNQUARANTINE, SM_SWEEP_REASON_UNDETERMINED } SweepReason_t; @@ -1322,12 +1369,14 @@ void Switch_Enqueue_Type(Topology_t *, Node_t *, int, int); int portBytes; \ NODEP->port = (Port_t *)(NODEP+1); \ NODEP->uniformVL = 1; \ + NODEP->ponodep = sm_popo_get_node(&sm_popo, &nodeInfo); \ for (local_i = 0; local_i < (int)(COUNT); local_i++) { \ (NODEP->port)[local_i].state = IB_PORT_NOP; \ (NODEP->port)[local_i].path[0] = 0xff; \ (NODEP->port)[local_i].index = local_i; \ (NODEP->port)[local_i].nodeno = -1; \ (NODEP->port)[local_i].portno = -1; \ + (NODEP->port)[local_i].poportp = sm_popo_get_port(&sm_popo, NODEP->ponodep, local_i); \ if (sm_dynamic_port_alloc()) { \ (NODEP->port)[local_i].portData = NULL; \ if (local_i == sm_config.port) { \ @@ -1745,6 +1794,22 @@ static __inline__ int sm_is_scae_allowed(Node_t * nodep) { || (sm_config.switchCascadeActivateEnable == SCAE_SW_ONLY && nodep->nodeInfo.NodeType == STL_NODE_SW); } +static __inline__ boolean is_swport(Port_t *portp) { + return portp->portData->nodePtr->nodeInfo.NodeType == NI_TYPE_SWITCH; +} + +static __inline__ boolean is_hfiport(Port_t *portp) { + return portp->portData->nodePtr->nodeInfo.NodeType == NI_TYPE_CA; +} + +static __inline__ boolean is_swport0(Port_t *portp) { + return (portp->portData->nodePtr->nodeInfo.NodeType == NI_TYPE_SWITCH && portp->index == 0); +} + +static __inline__ boolean is_extswport(Port_t *portp) { + return (portp->portData->nodePtr->nodeInfo.NodeType == NI_TYPE_SWITCH && portp->index > 0); +} + // --------------------------------------------------------------------------- // // @@ -1869,6 +1934,9 @@ extern int esmLoopTestInjectNode; extern uint8_t esmLoopTestInjectEachSweep; extern uint8_t esmLoopTestForceInject; extern int esmLoopTestMinISLRedundancy; + +extern Popo_t sm_popo; + // // Miscellaneous stuff. // @@ -2024,9 +2092,10 @@ typedef struct McSpaningTrees { extern SMThread_t * sm_threads; extern IBhandle_t fd_sa; -extern IBhandle_t fd_sa_w; +extern IBhandle_t fd_sa_writer; extern IBhandle_t fd_multi; extern IBhandle_t fd_async; +extern IBhandle_t fd_async_request; extern IBhandle_t fd_saTrap; extern IBhandle_t fd_policy; extern IBhandle_t fd_topology; @@ -2041,6 +2110,9 @@ extern int uniqueSpanningTreeCount; extern Node_t *sm_mcSpanningTreeRootSwitch; extern uint64_t sm_mcSpanningTreeRootGuid; +extern Status_t sm_update_mc_groups(VirtualFabrics_t *newVF, VirtualFabrics_t *oldVF); + + // // Prototypes. // @@ -2197,7 +2269,6 @@ Status_t sm_bounce_link(Topology_t *, Node_t *, Port_t *); Status_t sm_bounce_all_switch_ports(Topology_t *topop, Node_t *nodep, Port_t *portp, uint8_t *path); Status_t sm_get_CapabilityMask(IBhandle_t, uint8_t, uint32_t *); Status_t sm_set_CapabilityMask(IBhandle_t, uint8_t, uint32_t); -Status_t sm_process_notice(Notice_t *); Node_t *sm_find_guid(Topology_t *, uint64_t); Node_t *sm_find_quarantined_guid(Topology_t *topop, uint64_t guid); Node_t *sm_find_next_guid(Topology_t *, uint64_t); @@ -2247,10 +2318,10 @@ void sm_mark_link_down(Topology_t *topop, Port_t *portp); // sm_activate.c prototypes // -void sm_arm_node(Topology_t *, Node_t *); -void sm_activate_all_hfi_first_safe(Topology_t *, pActivationRetry_t); -void sm_activate_all_hfi_first(Topology_t *, pActivationRetry_t); -void sm_activate_all_switch_first(Topology_t *, pActivationRetry_t); +Status_t sm_arm_node(Topology_t *, Node_t *); +Status_t sm_activate_all_hfi_first_safe(Topology_t *, pActivationRetry_t); +Status_t sm_activate_all_hfi_first(Topology_t *, pActivationRetry_t); +Status_t sm_activate_all_switch_first(Topology_t *, pActivationRetry_t); // // sm_routing.c prototypes @@ -2355,7 +2426,7 @@ Status_t sm_dispatch_new_req(sm_dispatch_t *, sm_dispatch_send_params_t *, Node_ Status_t sm_dispatch_enqueue(sm_dispatch_req_t *req); Status_t sm_dispatch_init(sm_dispatch_t *disp, uint32_t reqsSupported); Status_t sm_dispatch_wait(sm_dispatch_t *disp); -Status_t sm_dispatch_clear(sm_dispatch_t *disp); +void sm_dispatch_clear(sm_dispatch_t *disp); Status_t sm_dispatch_update(sm_dispatch_t *disp); void sm_dispatch_bump_passcount(sm_dispatch_t *disp); @@ -2400,12 +2471,8 @@ char* smGetVfName(uint16_t); // // sm_ar.c prototypes +// Send PGT and PGFT to node if necessary. // -Status_t sm_SetARPause(Node_t *, uint8_t); - -/** - Send PGT and PGFT to node if necessary. -*/ Status_t sm_AdaptiveRoutingSwitchUpdate(Topology_t*, Node_t*); uint8_t sm_VerifyAdaptiveRoutingConfig(Node_t *p); @@ -2785,5 +2852,29 @@ struct _PortDataVLArb * sm_port_getNewArb(Port_t * portp); */ void sm_port_releaseNewArb(Port_t * portp); +// +// persistent topology api +// + +extern void sm_popo_init(Popo_t * popop); +extern void sm_popo_destroy(Popo_t * popop); +extern void sm_popo_report(Popo_t * popop); +extern PopoNode_t * sm_popo_get_node(Popo_t * popop, const STL_NODE_INFO * nodeInfo); +extern PopoPort_t * sm_popo_get_port(Popo_t * popop, PopoNode_t * ponodep, uint8_t port); + +extern boolean sm_popo_is_port_quarantined(Popo_t * popop, Port_t * portp); +extern boolean sm_popo_is_node_quarantined(Popo_t * popop, uint64_t guid); +extern void sm_popo_quarantine_port(Popo_t * popop, Port_t * portp, PopoQuarantineType_t type); +extern boolean sm_popo_clear_short_quarantine(Popo_t * popop); + +extern uint64_t sm_popo_scale_timeout(Popo_t * popop, uint64_t timeout); +extern void sm_popo_report_timeout(Popo_t * popop, uint64_t timeout); +extern Status_t sm_popo_port_error(Popo_t * popop, Topology_t * topop, Port_t * portp, Status_t status); +extern void sm_popo_reset_errors(Popo_t * popop); +extern boolean sm_popo_should_abandon(Popo_t * popop); + +extern void sm_popo_update_node(PopoNode_t * ponodep); +extern void sm_popo_end_sweep(Popo_t * popop); + #endif // _SM_L_H_ diff --git a/Esm/ib/src/smi/sa/Makefile b/Esm/ib/src/smi/sa/Makefile index 64bd8a82..94eef295 100755 --- a/Esm/ib/src/smi/sa/Makefile +++ b/Esm/ib/src/smi/sa/Makefile @@ -1,6 +1,6 @@ # BEGIN_ICS_COPYRIGHT8 **************************************** # -# Copyright (c) 2015, Intel Corporation +# Copyright (c) 2015-2017, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -56,7 +56,7 @@ CFILES = \ sa_BufferControlTableRecord.c sa_CongestionRecords.c \ sa_CableInfoRecord.c sa_PortGroupRecord.c \ sa_SCSLTableRecord.c sa_SCVLTableRecord.c \ - sa_SCSCTableRecord.c + sa_SCSCTableRecord.c sa_SwitchCostRecord.c # Add more c files here # C++ files (.cpp) diff --git a/Esm/ib/src/smi/sa/sa_BufferControlTableRecord.c b/Esm/ib/src/smi/sa/sa_BufferControlTableRecord.c index 7292aae9..77735cdc 100644 --- a/Esm/ib/src/smi/sa/sa_BufferControlTableRecord.c +++ b/Esm/ib/src/smi/sa/sa_BufferControlTableRecord.c @@ -133,7 +133,7 @@ sa_BufferControlTableRecord_Set(uint8_t *pRec, Node_t *pNode, Port_t *pPort) IB_ENTER("sa_BufferControlTableRecord_Set", pRec, pNode, pPort, 0); memset(&record, 0, sizeof(record)); Port_t *swport; - Lid_t lid; + STL_LID lid; if ((pNode->nodeInfo.NodeType == NI_TYPE_SWITCH) && (sm_valid_port((swport = sm_get_port(pNode,0))))) { @@ -163,7 +163,7 @@ sa_BufferControlTableRecord_GetTable(Mai_t *maip, uint32_t *records) STL_SA_MAD samad; Status_t status; bool_t checkLid; - Lid_t lid=0; + STL_LID lid=0; bool_t checkPort; uint8_t portNum=0; STL_BUFFER_CONTROL_TABLE_RECORD* pCtrlTabRec; diff --git a/Esm/ib/src/smi/sa/sa_CongestionRecords.c b/Esm/ib/src/smi/sa/sa_CongestionRecords.c index d9b96537..a69d068a 100644 --- a/Esm/ib/src/smi/sa/sa_CongestionRecords.c +++ b/Esm/ib/src/smi/sa/sa_CongestionRecords.c @@ -365,7 +365,7 @@ sa_CongInfoRecord_GetTable(Mai_t *maip, uint32_t *records) { STL_SA_MAD samad; Status_t status; bool_t checkLid; - Lid_t lid=0; + STL_LID lid=0; STL_CONGESTION_INFO_RECORD record; IB_ENTER("sa_CongInfoRecord_GetTable", maip, *records, 0, 0); @@ -461,7 +461,7 @@ sa_SwitchCongRecord_GetTable(Mai_t *maip, uint32_t *records) { STL_SA_MAD samad; Status_t status; bool_t checkLid; - Lid_t lid=0; + STL_LID lid=0; STL_SWITCH_CONGESTION_SETTING_RECORD record; @@ -554,7 +554,7 @@ sa_SwitchPortCongRecord_GetTable(Mai_t *maip, uint32_t *records) { STL_SA_MAD samad; Status_t status; bool_t checkLid; - Lid_t lid=0; + STL_LID lid=0; STL_SWITCH_PORT_CONGESTION_SETTING_RECORD record = {{0}}; IB_ENTER(__func__, maip, *records, 0, 0); @@ -636,7 +636,7 @@ sa_HFICongRecord_GetTable(Mai_t *maip, uint32_t *records) { STL_SA_MAD samad; Status_t status; bool_t checkLid; - Lid_t lid=0; + STL_LID lid=0; STL_HFI_CONGESTION_SETTING_RECORD record; @@ -738,7 +738,7 @@ sa_HFICongCtrlRecord_GetTable(Mai_t *maip, uint32_t *records) { STL_SA_MAD samad; Status_t status; bool_t checkLid; - Lid_t lid=0; + STL_LID lid=0; bool_t checkBlock; uint16_t blockNum=0; uint16_t numBlocks=0; diff --git a/Esm/ib/src/smi/sa/sa_InformInfo.c b/Esm/ib/src/smi/sa/sa_InformInfo.c index 6b814c43..4a1cdebf 100755 --- a/Esm/ib/src/smi/sa/sa_InformInfo.c +++ b/Esm/ib/src/smi/sa/sa_InformInfo.c @@ -62,8 +62,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "sm_l.h" #include "sa_l.h" #include "sm_dbsync.h" -#include -#include +#include +#include #include "stl_print.h" extern IB_GID nullGid; @@ -196,7 +196,8 @@ sa_InformInfo(Mai_t * maip, sa_cntxt_t * sa_cntxt) STL_SA_MAD samad; Status_t status; STL_INFORM_INFO informInfo; - char data[sizeof(STL_INFORM_INFO)]; + uint16_t attribOffset; + uint8_t *data = sa_data; IB_ENTER("sa_InformInfo", maip, sa_cntxt, 0, 0); @@ -299,8 +300,11 @@ sa_InformInfo(Mai_t * maip, sa_cntxt_t * sa_cntxt) // Send the reply back. // if (maip->base.cversion == STL_SA_CLASS_VERSION) { - BSWAPCOPY_STL_INFORM_INFO(&informInfo, (STL_INFORM_INFO *) data); - sa_cntxt_data(sa_cntxt, data, sizeof(STL_INFORM_INFO)); + BSWAPCOPY_STL_INFORM_INFO(&informInfo, (STL_INFORM_INFO *)data); + + attribOffset = sizeof(STL_INFORM_INFO) + Calculate_Padding(sizeof(STL_INFORM_INFO)); + sa_cntxt->attribLen = attribOffset; + sa_cntxt_data(sa_cntxt, data, attribOffset); } else { IB_INFORM_INFO *ibInformInfo = (IB_INFORM_INFO *)data; @@ -312,17 +316,20 @@ sa_InformInfo(Mai_t * maip, sa_cntxt_t * sa_cntxt) if (informInfo.LIDRangeBegin == STL_LID_PERMISSIVE) ibInformInfo->LIDRangeBegin = PERMISSIVE_LID; else - ibInformInfo->LIDRangeBegin = (uint16)ntoh32(informInfo.LIDRangeBegin); - ibInformInfo->LIDRangeEnd = (uint16)ntoh32(informInfo.LIDRangeEnd); - ibInformInfo->Type = ntoh16(informInfo.Type); - ibInformInfo->Reserved = 0; - ibInformInfo->u.Generic.TrapNumber = ntoh16(informInfo.u.Generic.TrapNumber); + ibInformInfo->LIDRangeBegin = (uint16)ntoh32(informInfo.LIDRangeBegin); + ibInformInfo->LIDRangeEnd = (uint16)ntoh32(informInfo.LIDRangeEnd); + ibInformInfo->Type = ntoh16(informInfo.Type); + ibInformInfo->Reserved = 0; + ibInformInfo->u.Generic.TrapNumber = ntoh16(informInfo.u.Generic.TrapNumber); /* NOTO BENE: THE NAMES OF THE UNIONS CHANGED BETWEEN IB AND STL... */ - ibInformInfo->u.Generic.u2.AsReg32 = ntoh32(informInfo.u.Generic.u1.AsReg32); - ibInformInfo->u.Generic.u.AsReg32 = ntoh32(informInfo.u.Generic.u2.AsReg32); - ibInformInfo->u.Generic.u2.s.Reserved = 0; - ibInformInfo->u.Generic.u.s.Reserved = 0; - sa_cntxt_data(sa_cntxt, data, sizeof(IB_INFORM_INFO)); + ibInformInfo->u.Generic.u2.AsReg32 = ntoh32(informInfo.u.Generic.u1.AsReg32); + ibInformInfo->u.Generic.u.AsReg32 = ntoh32(informInfo.u.Generic.u2.AsReg32); + ibInformInfo->u.Generic.u2.s.Reserved = 0; + ibInformInfo->u.Generic.u.s.Reserved = 0; + + attribOffset = sizeof(IB_INFORM_INFO) + Calculate_Padding(sizeof(IB_INFORM_INFO)); + sa_cntxt->attribLen = attribOffset; + sa_cntxt_data(sa_cntxt, data, attribOffset); } (void) sa_send_reply(maip, sa_cntxt); @@ -334,10 +341,10 @@ Status_t sa_InformInfo_Subscribe(Mai_t * maip, STL_INFORM_INFO * iip, uint8_t ibMode) { int validateLidRange = 1; - Lid_t lid; - Lid_t topLid; - Lid_t LIDRangeEnd; - Lid_t LIDRangeBegin; + STL_LID lid; + STL_LID topLid; + STL_LID LIDRangeEnd; + STL_LID LIDRangeBegin; Node_t *nodep; Port_t *portp; Port_t *subscriberPortp, subsPort; @@ -528,7 +535,7 @@ sa_InformInfo_Subscribe(Mai_t * maip, STL_INFORM_INFO * iip, uint8_t ibMode) } status = sa_Authenticate_Access(SA_INFORMINFO, - (Lid_t) 0, + (STL_LID) 0, maip->addrInfo.slid, portp->portData->lid); if (status != VSTATUS_OK) { diff --git a/Esm/ib/src/smi/sa/sa_LFTableRecord.c b/Esm/ib/src/smi/sa/sa_LFTableRecord.c index 5fe3d1e9..a8cdb5f6 100755 --- a/Esm/ib/src/smi/sa/sa_LFTableRecord.c +++ b/Esm/ib/src/smi/sa/sa_LFTableRecord.c @@ -126,7 +126,7 @@ sa_LFTableRecord(Mai_t *maip, sa_cntxt_t* sa_cntxt ) { Status_t sa_LFTableRecord_Set(uint8_t *lftp, Node_t *nodep, Port_t *portp, uint16_t index) { - Lid_t lid; + STL_LID lid; Port_t *lftPortp; uint32_t length; STL_LINEAR_FORWARDING_TABLE_RECORD lftRecord; diff --git a/Esm/ib/src/smi/sa/sa_McMemberRecord.c b/Esm/ib/src/smi/sa/sa_McMemberRecord.c index f0274d09..fc913d05 100755 --- a/Esm/ib/src/smi/sa/sa_McMemberRecord.c +++ b/Esm/ib/src/smi/sa/sa_McMemberRecord.c @@ -289,7 +289,7 @@ sa_McMemberRecord_Set(Mai_t *maip, uint32_t *records) { uint8_t activeRate; uint8_t life; uint8_t saLife, scope=0; - Lid_t mLid; + STL_LID mLid; uint64_t guid; uint64_t prefix; // portp is port requested to join/leave MC group @@ -2234,7 +2234,7 @@ Status_t createMCastGroup(uint64_t* mgid, uint16_t pkey, uint8_t mtu, uint8_t ra McGroup_t *mcGroup = NULL; McMember_t *mcMember = NULL; STL_MCMEMBER_RECORD *mcmp; - Lid_t mLid; + STL_LID mLid; IB_GID mGid; int vf = 0; VirtualFabrics_t *VirtualFabrics = old_topology.vfs_ptr; diff --git a/Esm/ib/src/smi/sa/sa_NodeRecord.c b/Esm/ib/src/smi/sa/sa_NodeRecord.c index 44b19dac..43afe262 100755 --- a/Esm/ib/src/smi/sa/sa_NodeRecord.c +++ b/Esm/ib/src/smi/sa/sa_NodeRecord.c @@ -54,7 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "os_g.h" #include "ib_mad.h" #include "ib_sa.h" -#include "iba/stl_sa.h" +#include "iba/stl_sa_priv.h" #include "ib_status.h" #include "cs_g.h" #include "mai_g.h" @@ -154,7 +154,7 @@ sa_NodeRecord(Mai_t * maip, sa_cntxt_t * sa_cntxt) static Status_t sa_NodeRecord_Set(uint8_t * cp, Node_t * nodep, Port_t * portp) { - Lid_t lid; + STL_LID lid; uint32_t portno; Port_t *nrPortp; STL_NODE_RECORD nodeRecord = {{0}}; @@ -206,7 +206,7 @@ sa_NodeRecord_Set(uint8_t * cp, Node_t * nodep, Port_t * portp) static Status_t sa_IbNodeRecord_Set(uint8_t * cp, Node_t * nodep, Port_t * portp) { - Lid_t lid; + STL_LID lid; uint32_t portno; Port_t *nrPortp; IB_NODE_RECORD *ibNodeRecord = (IB_NODE_RECORD *)cp; @@ -283,7 +283,7 @@ sa_NodeRecord_GetTable(Mai_t * maip, uint32_t * records, SACacheEntry_t ** outCa Status_t status; STL_NODE_RECORD nodeRecord; uint32_t newRecords; - Lid_t lid = 0; + STL_LID lid = 0; Port_t *portp; IB_ENTER("sa_NodeRecord_GetTable", maip, records, 0, 0); @@ -438,7 +438,7 @@ sa_IbNodeRecord_GetTable(Mai_t * maip, uint32_t * records) Status_t status; IB_NODE_RECORD ibNodeRecord; uint32_t newRecords; - Lid_t lid = 0; + STL_LID lid = 0; Port_t *portp; IB_ENTER("sa_IbNodeRecord_GetTable", maip, records, 0, 0); @@ -487,9 +487,9 @@ sa_IbNodeRecord_GetTable(Mai_t * maip, uint32_t * records) } *records += newRecords; } - } else if (samad.header.mask & NR_COMPONENTMASK_NI_NODETYPE) { + } else if (samad.header.mask & IB_NODE_RECORD_COMP_NODETYPE) { /* look for specific nodetype and clear nodetype mask to not try to match again */ - samad.header.mask = samad.header.mask & ~NR_COMPONENTMASK_NI_NODETYPE; + samad.header.mask = samad.header.mask & ~IB_NODE_RECORD_COMP_NODETYPE; if (ibNodeRecord.NodeInfoData.NodeType == NI_TYPE_CA) { for_all_ca_nodes(&old_topology, nodep) { if ((newRecords = sa_IbNodeRecord_Matches(&data, &samad, nodep, @@ -517,7 +517,7 @@ sa_IbNodeRecord_GetTable(Mai_t * maip, uint32_t * records) "Invalid node type[%d] in request from lid 0x%x", ibNodeRecord.NodeInfoData.NodeType, lid); } - } else if (samad.header.mask & NR_COMPONENTMASK_NODEGUID) { + } else if (samad.header.mask & IB_NODE_RECORD_COMP_NODEGUID) { /* look for a specific node guid */ if ((nodep = sm_find_guid(&old_topology, ibNodeRecord.NodeInfoData.NodeGUID)) != NULL) { if ((newRecords = sa_IbNodeRecord_Matches(&data, &samad, nodep, @@ -612,7 +612,7 @@ sa_IbNodeRecord_Matches(uint8_t ** data, STL_SA_MAD * samad, Node_t * nodep, IB_ continue; } - if ((samad->header.mask & NR_COMPONENTMASK_LID) + if ((samad->header.mask & IB_NODE_RECORD_COMP_LID) && (portp->portData->lid != nr->RID.s.LID)) { if ((portp->portData->lid <= nr->RID.s.LID) && (nr->RID.s.LID <= sm_port_top_lid(portp))) { @@ -628,8 +628,8 @@ sa_IbNodeRecord_Matches(uint8_t ** data, STL_SA_MAD * samad, Node_t * nodep, IB_ } /* if specific portNumber is desired, create node record for that port only */ - if (!(samad->header.mask & NR_COMPONENTMASK_PORTNUMBER) || - ((samad->header.mask & NR_COMPONENTMASK_PORTNUMBER) + if (!(samad->header.mask & IB_NODE_RECORD_COMP_LOCALPORTNUM) || + ((samad->header.mask & IB_NODE_RECORD_COMP_LOCALPORTNUM) && (portp->portno == nr->NodeInfoData.u1.s.LocalPortNum))) { if (sa_check_len(*data, sizeof(IB_NODE_RECORD), bytes) != VSTATUS_OK) { @@ -662,7 +662,7 @@ sa_NodeRecord_CheckCache(STL_SA_MAD * samad, STL_NODE_RECORD * nr, SACacheEntry_ (void) vs_lock(&saCache.lock); - if (samad->header.mask == NR_COMPONENTMASK_NI_NODETYPE) { + if (samad->header.mask == IB_NODE_RECORD_COMP_NODETYPE) { if (nr->NodeInfo.NodeType == NI_TYPE_CA) { (void) sa_cache_get(SA_CACHE_FI_NODES, outCache); } else if (nr->NodeInfo.NodeType == NI_TYPE_SWITCH) { diff --git a/Esm/ib/src/smi/sa/sa_PartitionRecord.c b/Esm/ib/src/smi/sa/sa_PartitionRecord.c index 9749f562..eda7d6ca 100755 --- a/Esm/ib/src/smi/sa/sa_PartitionRecord.c +++ b/Esm/ib/src/smi/sa/sa_PartitionRecord.c @@ -71,7 +71,7 @@ sa_setPartitionRecord(uint8_t * data, Node_t * node, Port_t * port, int block) STL_P_KEY_TABLE_RECORD record; int pkey_idx = 0, i = 0; Port_t *swport; - Lid_t lid; + STL_LID lid; memset(&record, 0, sizeof(record)); @@ -133,16 +133,16 @@ sa_getPartitionRecordTable(Mai_t *maip, uint32_t * records) BSWAPCOPY_STL_SA_MAD((STL_SA_MAD*)maip->data, &samad, sizeof(STL_P_KEY_TABLE_RECORD)); pPartitionRec = (STL_P_KEY_TABLE_RECORD *)samad.data; - checkLid = (samad.header.mask & PKEY_COMPONENTMASK_PORTLID); + checkLid = (samad.header.mask & IB_PKEYTABLE_RECORD_COMP_LID); if (checkLid) { portLid = ntoh32(pPartitionRec->RID.LID); - samad.header.mask ^= PKEY_COMPONENTMASK_PORTLID; + samad.header.mask ^= IB_PKEYTABLE_RECORD_COMP_LID; } - checkPort = (samad.header.mask & PKEY_COMPONENTMASK_PORTNUM); + checkPort = (samad.header.mask & IB_PKEYTABLE_RECORD_COMP_PORTNUM); if (checkPort) { portNum = pPartitionRec->RID.PortNum; - samad.header.mask ^= PKEY_COMPONENTMASK_PORTNUM; + samad.header.mask ^= IB_PKEYTABLE_RECORD_COMP_PORTNUM; } /* C15-0.2.2 - PKeyTableRecords and ServiceAssociationRecords shall only diff --git a/Esm/ib/src/smi/sa/sa_PortGroupRecord.c b/Esm/ib/src/smi/sa/sa_PortGroupRecord.c index ce14d37a..439f1f0a 100644 --- a/Esm/ib/src/smi/sa/sa_PortGroupRecord.c +++ b/Esm/ib/src/smi/sa/sa_PortGroupRecord.c @@ -194,7 +194,7 @@ GetPortGroupRecord(Mai_t *maip, uint32_t *records) Status_t status; Node_t *nodep; bool_t checkLid; - Lid_t lid=0, port0Lid=0; + STL_LID lid=0, port0Lid=0; bool_t checkBlock; uint8_t blockNum=0; int endBlock, blkIdx; @@ -323,7 +323,7 @@ GetPortGroupFwdRecord(Mai_t *maip, uint32_t *records) Status_t status; Node_t *nodep; bool_t checkLid; - Lid_t lid=0, port0Lid=0; + STL_LID lid=0, port0Lid=0; bool_t checkBlock; uint32_t blockNum=0; uint32_t endBlock, blkIdx; diff --git a/Esm/ib/src/smi/sa/sa_PortInfoRecord.c b/Esm/ib/src/smi/sa/sa_PortInfoRecord.c index ca250bee..e768662d 100755 --- a/Esm/ib/src/smi/sa/sa_PortInfoRecord.c +++ b/Esm/ib/src/smi/sa/sa_PortInfoRecord.c @@ -55,7 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "os_g.h" #include "ib_mad.h" #include "ib_sa.h" -#include "iba/stl_sa.h" +#include "iba/stl_sa_priv.h" #include "ib_status.h" #include "cs_g.h" #include "mai_g.h" @@ -137,7 +137,7 @@ sa_PortInfoRecord(Mai_t *maip, sa_cntxt_t* sa_cntxt ) { static Status_t sa_PortInfoRecord_Set(uint8_t *prp, Node_t *nodep, Port_t *portp, STL_SA_MAD *samad) { uint32_t portno; - Lid_t lid; + STL_LID lid; Port_t *piPortp; STL_PORTINFO_RECORD portInfoRecord; @@ -183,7 +183,7 @@ sa_PortInfoRecord_Set(uint8_t *prp, Node_t *nodep, Port_t *portp, STL_SA_MAD *sa static Status_t sa_IbPortInfoRecord_Set(uint8_t *prp, Node_t *nodep, Port_t *portp, STL_SA_MAD *samad) { uint32_t portno; - Lid_t lid; + STL_LID lid; Port_t *piPortp; IB_PORTINFO_RECORD *ibPortInfoRecord = (IB_PORTINFO_RECORD *)prp; @@ -253,7 +253,7 @@ sa_PortInfoRecord_GetTable(Mai_t *maip, uint32_t *records) { STL_SA_MAD samad; Status_t status; bool_t checkLid; - Lid_t endPortLid=0; + STL_LID endPortLid=0; uint8_t checkCapMask = 0; uint32_t capMask = 0, cap; STL_PORTINFO_RECORD *portInfoRecp; @@ -407,7 +407,7 @@ sa_IbPortInfoRecord_GetTable(Mai_t *maip, uint32_t *records) { STL_SA_MAD samad; Status_t status; bool_t checkLid; - Lid_t endPortLid=0; + STL_LID endPortLid=0; uint8_t checkCapMask = 0; uint32_t capMask = 0, cap; diff --git a/Esm/ib/src/smi/sa/sa_QuarantinedNodeRecord.c b/Esm/ib/src/smi/sa/sa_QuarantinedNodeRecord.c index 8434fe47..5c164894 100755 --- a/Esm/ib/src/smi/sa/sa_QuarantinedNodeRecord.c +++ b/Esm/ib/src/smi/sa/sa_QuarantinedNodeRecord.c @@ -29,7 +29,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* [ICS VERSION STRING: unknown] */ #include "os_g.h" -#include "iba/stl_sa.h" +#include "iba/stl_sa_priv.h" #include "ib_status.h" #include "cs_g.h" #include "mai_g.h" diff --git a/Esm/ib/src/smi/sa/sa_SCSCTableRecord.c b/Esm/ib/src/smi/sa/sa_SCSCTableRecord.c index 6709c229..3d9e23ca 100755 --- a/Esm/ib/src/smi/sa/sa_SCSCTableRecord.c +++ b/Esm/ib/src/smi/sa/sa_SCSCTableRecord.c @@ -105,7 +105,7 @@ sa_SCSCTableRecord(Mai_t *maip, sa_cntxt_t* sa_cntxt) { } Status_t -sa_SCSCTableRecord_Set(uint8_t *slp, Node_t *nodep, Port_t *in_portp, Port_t *out_portp, Lid_t lid) { +sa_SCSCTableRecord_Set(uint8_t *slp, Node_t *nodep, Port_t *in_portp, Port_t *out_portp, STL_LID lid) { STL_SC_MAPPING_TABLE_RECORD scSCTableRecord; int i; @@ -158,8 +158,8 @@ sa_SCSCTableRecord_GetTable(Mai_t *maip, uint32_t *records) { bool_t checkLid; bool_t checkInPort; bool_t checkOutPort; - Lid_t lid = 0; - Lid_t portLid=0; + STL_LID lid = 0; + STL_LID portLid=0; uint16_t inPort=0; uint16_t outPort=0; diff --git a/Esm/ib/src/smi/sa/sa_SCSLTableRecord.c b/Esm/ib/src/smi/sa/sa_SCSLTableRecord.c index bd8b012e..25981eef 100644 --- a/Esm/ib/src/smi/sa/sa_SCSLTableRecord.c +++ b/Esm/ib/src/smi/sa/sa_SCSLTableRecord.c @@ -107,7 +107,7 @@ sa_SCSLTableRecord(Mai_t *maip, sa_cntxt_t* sa_cntxt) { Status_t sa_SCSLTableRecord_Set(uint8_t *slp, Node_t *nodep, Port_t *portp) { - Lid_t lid; + STL_LID lid; Port_t *scslPortp; STL_SC2SL_MAPPING_TABLE_RECORD scSLTableRecord; diff --git a/Esm/ib/src/smi/sa/sa_SCVLTableRecord.c b/Esm/ib/src/smi/sa/sa_SCVLTableRecord.c index bdce4cbb..f409a37b 100644 --- a/Esm/ib/src/smi/sa/sa_SCVLTableRecord.c +++ b/Esm/ib/src/smi/sa/sa_SCVLTableRecord.c @@ -146,7 +146,7 @@ sa_SCVLTableRecord(Mai_t *maip, sa_cntxt_t* sa_cntxt) { Status_t sa_SCVLTableRecord_Set(uint8_t *slp, Node_t *nodep, Port_t *portp, uint16_t attrib) { - Lid_t lid; + STL_LID lid; Port_t *scvlPortp; STL_SC2VL_R_MAPPING_TABLE_RECORD scVLTableRecord; diff --git a/Esm/ib/src/smi/sa/sa_SLSCTableRecord.c b/Esm/ib/src/smi/sa/sa_SLSCTableRecord.c index 43aa62c5..e5ab1ccc 100755 --- a/Esm/ib/src/smi/sa/sa_SLSCTableRecord.c +++ b/Esm/ib/src/smi/sa/sa_SLSCTableRecord.c @@ -107,7 +107,7 @@ sa_SLSCTableRecord(Mai_t *maip, sa_cntxt_t* sa_cntxt) { Status_t sa_SLSCTableRecord_Set(uint8_t *slp, Node_t *nodep, Port_t *portp) { - Lid_t lid; + STL_LID lid; Port_t *slscPortp; STL_SL2SC_MAPPING_TABLE_RECORD slSCTableRecord; diff --git a/Esm/ib/src/smi/sa/sa_ServiceRecord.c b/Esm/ib/src/smi/sa/sa_ServiceRecord.c index 2c9650ff..f260b4da 100755 --- a/Esm/ib/src/smi/sa/sa_ServiceRecord.c +++ b/Esm/ib/src/smi/sa/sa_ServiceRecord.c @@ -175,18 +175,7 @@ sa_ServiceRecord(Mai_t *maip, sa_cntxt_t *sa_cntxt) { records = 0; // Check Base and Class Version - if (maip->base.bversion == STL_BASE_VERSION && maip->base.cversion == STL_SA_CLASS_VERSION) { -#ifdef NO_STL_SERVICE_OUTPUT // SA shouldn't support STL Service Record - maip->base.status = MAD_STATUS_BAD_CLASS; - (void)sa_send_reply(maip, sa_cntxt); - IB_LOG_WARN_FMT(__func__, "invalid Base and/or Class Versions: Base %u, Class %u", - maip->base.bversion, maip->base.cversion); - IB_EXIT(__func__, VSTATUS_OK); - return VSTATUS_OK; -#else - rec_sz = sizeof(STL_SERVICE_RECORD); -#endif - } else if (maip->base.bversion == IB_BASE_VERSION && maip->base.cversion == SA_MAD_CVERSION) { + if (maip->base.bversion == IB_BASE_VERSION && maip->base.cversion == SA_MAD_CVERSION) { rec_sz = sizeof(IB_SERVICE_RECORD); } else { // Generate an error response and return. diff --git a/Esm/ib/src/smi/sa/sa_SwitchCostRecord.c b/Esm/ib/src/smi/sa/sa_SwitchCostRecord.c new file mode 100644 index 00000000..15addecf --- /dev/null +++ b/Esm/ib/src/smi/sa/sa_SwitchCostRecord.c @@ -0,0 +1,267 @@ +/* BEGIN_ICS_COPYRIGHT5 **************************************** + +Copyright (c) 2017, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +** END_ICS_COPYRIGHT5 ****************************************/ + +/* [ICS VERSION STRING: unknown] */ + +//=========================================================================== +// +// FILE NAME +// sa_SwitchCostRecord.c +// +// DESCRIPTION +// This file contains the routines to process the SA requests for +// records of the SwitchCostRecord type. +// +// DATA STRUCTURES +// +// +// FUNCTIONS +// +// +// DEPENDENCIES +// +// +// +// +//===========================================================================// + +#include "iba/stl_sa_priv.h" + + +#include "ib_status.h" +#include "ib_sa.h" + +#include "sm_l.h" +#include "sa_l.h" +#include "sm_counters.h" + +static Status_t sa_SwitchCostRecord_GetTable(Mai_t * maip, uint32_t *records); + +Status_t +sa_SwitchCostRecord(Mai_t *maip, sa_cntxt_t *sa_cntxt) +{ + uint32_t records; + + uint32_t attribOffset; + + IB_ENTER(__func__, maip, 0, 0, 0); + + // Assume failure + records = 0; + + // Basic Checks + if (maip->base.method == SA_CM_GET){ + INCREMENT_COUNTER(smCounterSaRxGetSwitchCostRecord); + } else if (maip->base.method == SA_CM_GETTABLE){ + INCREMENT_COUNTER(smCounterSaRxGetTblSwitchCostRecord); + } else { + maip->base.status = MAD_STATUS_BAD_METHOD; + IB_LOG_WARN_FMT(__func__, "Invalid method: %s (%u)", + cs_getMethodText(maip->base.method), maip->base.method); + (void)sa_send_reply(maip, sa_cntxt); + IB_EXIT(__func__, VSTATUS_OK); + return VSTATUS_OK; + } + + // Check Base and Class Version + if (maip->base.bversion != STL_BASE_VERSION || maip->base.cversion != STL_SA_CLASS_VERSION) { + maip->base.status = MAD_STATUS_BAD_CLASS; + IB_LOG_WARN_FMT(__func__, "Invalid Base and/or Class Versions: Base %u, Class %u", + maip->base.bversion, maip->base.cversion); + (void)sa_send_reply(maip, sa_cntxt); + IB_EXIT(__func__, VSTATUS_OK); + return VSTATUS_OK; + } else { + (void)sa_SwitchCostRecord_GetTable(maip, &records); + } + + // reply + if (maip->base.status != MAD_STATUS_OK) { + records = 0; + } else if (records == 0) { + maip->base.status = MAD_STATUS_SA_NO_RECORDS; + } else if ((maip->base.method == SA_CM_GET) && (records != 1)) { + IB_LOG_WARN("too many records for GET: ", records); + records = 0; + maip->base.status = MAD_STATUS_SA_TOO_MANY_RECS; + } + + attribOffset = sizeof(STL_SWITCH_COST_RECORD) + Calculate_Padding(sizeof(STL_SWITCH_COST_RECORD)); + sa_cntxt->attribLen = attribOffset; + + sa_cntxt_data(sa_cntxt, sa_data, records * attribOffset); + (void)sa_send_reply(maip, sa_cntxt); + + IB_EXIT(__func__, VSTATUS_OK); + return VSTATUS_OK; +} + +static Status_t +sa_SwitchCostRecord_Set(uint8_t *cp, Node_t *source_nodep, cl_map_item_t **start_mi, bool_t whole_row) +{ + Port_t *source_portp; + Node_t *dest_nodep; + Port_t *dest_portp; + + STL_SWITCH_COST_RECORD costRecord = {0}; + int i; + Status_t status = VSTATUS_OK; + + IB_ENTER(__func__, cp, source_nodep, 0, 0); + + if (!sm_valid_port((source_portp = sm_get_port(source_nodep, 0)))) goto done; + + costRecord.SLID = source_portp->portData->lid; + + for (i = 0; + *start_mi != cl_qmap_end(old_topology.switchLids) && (i < STL_SWITCH_COST_NUM_ENTRIES); + *start_mi = cl_qmap_next(*start_mi)) { + dest_nodep = PARENT_STRUCT(*start_mi, Node_t, switchLidMapObj); + if (!dest_nodep || dest_nodep->nodeInfo.NodeType != NI_TYPE_SWITCH || + !sm_valid_port(dest_portp = sm_get_port(dest_nodep, 0))) + continue; + + if (!whole_row && (dest_portp->portData->lid >= source_portp->portData->lid)){ /* only need half of matrix */ + status = VSTATUS_DONE; + break; + } + + costRecord.Cost[i].DLID = dest_portp->portData->lid; + costRecord.Cost[i].value = old_topology.cost[Index(source_nodep->swIdx, dest_nodep->swIdx)]; + ++i; + } + + memcpy(cp, &costRecord, sizeof(STL_SWITCH_COST_RECORD)); + BSWAP_STL_SWITCH_COST_RECORD((STL_SWITCH_COST_RECORD *) cp); + +done: + IB_EXIT(__func__, status); + return (status); +} + +static Status_t +sa_SwitchCostRecord_GetTable(Mai_t *maip, uint32_t *records) +{ + uint8_t *data; + uint32_t bytes; + STL_SA_MAD samad; + Status_t status = VSTATUS_OK; + Node_t *nodep; + uint32_t portLid = 0; + bool_t checkLid; + cl_map_item_t *mi; + + IB_ENTER(__func__, maip, records, 0, 0); + + + *records = 0; + data = sa_data; + bytes = Calculate_Padding(sizeof(STL_SWITCH_COST_RECORD)); + + // Verify the size of the data received for the request + if (maip->datasize - sizeof(STL_SA_MAD_HEADER) < sizeof(STL_SWITCH_COST_RECORD)) { + IB_LOG_ERROR_FMT(__func__, + "invalid MAD length; size of STL_SWITCH_COST_RECORD[%"PRISZT"], datasize[%d]", + sizeof(STL_SWITCH_COST_RECORD), (int)(maip->datasize - sizeof(STL_SA_MAD_HEADER))); + maip->base.status = MAD_STATUS_SA_REQ_INVALID; + IB_EXIT(__func__, MAD_STATUS_SA_REQ_INVALID); + return (MAD_STATUS_SA_REQ_INVALID); + } + + BSWAPCOPY_STL_SA_MAD((STL_SA_MAD *) maip->data, &samad, sizeof(STL_SWITCH_COST_RECORD)); + BSWAP_STL_SWITCH_COST_RECORD((STL_SWITCH_COST_RECORD *)samad.data); + + checkLid = (samad.header.mask & STL_SWITCH_COST_REC_COMP_SLID); + if (checkLid) { + portLid = ((STL_SWITCH_COST_RECORD*)samad.data)->SLID; + samad.header.mask ^= STL_SWITCH_COST_REC_COMP_SLID; + } + + // Find the cost records + (void)vs_rdlock(&old_topology_lock); + + mi = cl_qmap_head(old_topology.switchLids); + if (mi == cl_qmap_end(old_topology.switchLids)) { + IB_LOG_ERROR_FMT(__func__, "No switches found in fabric"); + IB_EXIT(__func__, status); + return status; + } + + if (checkLid) { + Port_t *temp_port; + temp_port = sm_find_node_and_port_lid(&old_topology, portLid, &nodep); + + if (!sm_valid_port(temp_port) || (temp_port->state <= IB_PORT_DOWN) || nodep->nodeInfo.NodeType != NI_TYPE_SWITCH) { + goto done; + } + + mi= cl_qmap_head(old_topology.switchLids); + while(mi != cl_qmap_end(old_topology.switchLids)) { + if (sa_check_len(data, sizeof(STL_SWITCH_COST_RECORD), bytes) != VSTATUS_OK) { + status = VSTATUS_NOMEM; + IB_LOG_ERROR_FMT(__func__, "Reached size limit at %d records", *records); + goto done; + } + + if ((status = sa_SwitchCostRecord_Set(data, nodep, &mi, checkLid)) != VSTATUS_OK) { + maip->base.status = MAD_STATUS_SA_NO_RESOURCES; + goto done; + } + + sa_increment_and_pad(&data, sizeof(STL_SWITCH_COST_RECORD), bytes, records); + } + goto done; + } + + cl_map_item_t *start_mi = cl_qmap_head(old_topology.switchLids); + // collect cost records for each switch + for_all_qmap_item(old_topology.switchLids, mi) { + status = VSTATUS_OK; + nodep = PARENT_STRUCT(mi, Node_t, switchLidMapObj); + if (!nodep || nodep->nodeInfo.NodeType != NI_TYPE_SWITCH) continue; + while (status != VSTATUS_DONE && start_mi != cl_qmap_end(old_topology.switchLids)) { + if (sa_check_len(data, sizeof(STL_SWITCH_COST_RECORD), bytes) != VSTATUS_OK) { + status = VSTATUS_NOMEM; + IB_LOG_ERROR_FMT(__func__, "Reached size limit at %d records", *records); + goto done; + } + + status = sa_SwitchCostRecord_Set(data, nodep, &start_mi, checkLid); + sa_increment_and_pad(&data, sizeof(STL_SWITCH_COST_RECORD), bytes, records); + } + + start_mi = cl_qmap_head(old_topology.switchLids); + } + +done: + (void)vs_rwunlock(&old_topology_lock); + IB_EXIT(__func__, status); + return status; + +} diff --git a/Esm/ib/src/smi/sa/sa_SwitchInfoRecord.c b/Esm/ib/src/smi/sa/sa_SwitchInfoRecord.c index fca9a1e2..076e1ee5 100755 --- a/Esm/ib/src/smi/sa/sa_SwitchInfoRecord.c +++ b/Esm/ib/src/smi/sa/sa_SwitchInfoRecord.c @@ -129,7 +129,7 @@ sa_SwitchInfoRecord(Mai_t *maip, sa_cntxt_t* sa_cntxt) { Status_t sa_SwitchInfoRecord_Set(uint8_t *srp, Node_t *nodep, Port_t *portp) { - Lid_t lid; + STL_LID lid; Port_t *swiPortp; STL_SWITCHINFO_RECORD switchInfoRecord = {{0}}; diff --git a/Esm/ib/src/smi/sa/sa_Trap.c b/Esm/ib/src/smi/sa/sa_Trap.c index b335133f..229b33a5 100755 --- a/Esm/ib/src/smi/sa/sa_Trap.c +++ b/Esm/ib/src/smi/sa/sa_Trap.c @@ -65,8 +65,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "sa_l.h" #include "cs_context.h" #include "cs_queue.h" -#include "iba/stl_sa.h" -#include "iba/stl_sm.h" +#include "iba/stl_sa_priv.h" +#include "iba/stl_sm_priv.h" static Status_t sa_Trap_Forward(SubscriberKeyp, STL_NOTICE *); @@ -239,7 +239,7 @@ sm_sa_forwardNotice(STL_NOTICE * noticep) // NOTE: Needs to be called from under an old_topology lock. // static void -sa_updateTrapCountForPort(Lid_t lid, uint32_t portIndex, int disable) +sa_updateTrapCountForPort(STL_LID lid, uint32_t portIndex, int disable) { Node_t *nodep, *swnodep; Port_t *portp, *ext_portp, *swportp; @@ -479,6 +479,12 @@ sa_Trap(Mai_t *maip) { case MAD_SMT_BAD_PKEY_ONPORT: INCREMENT_COUNTER(smCounterTrapBadPKeySwPort); break; + case STL_SMA_TRAP_LINK_WIDTH: + INCREMENT_COUNTER(smCounterTrapLinkWidthDowngrade); + break; + case STL_TRAP_COST_MATRIX_CHANGE: + INCREMENT_COUNTER(smCounterTrapCostMatrixChange); + break; } /* Send a TrapRepress to the sender after inserting our Mkey */ @@ -575,7 +581,7 @@ sa_Trap(Mai_t *maip) { } }else{ //other capability bit changed, just get fresh port info STL_PORT_INFO portInfo; - Status_t status = SM_Get_PortInfo_LR(fd_topology, (1 << 24) | portp->index, sm_lid, portp->portData->lid, &portInfo); + Status_t status = SM_Get_PortInfo_LR(fd_async_request, (1 << 24) | portp->index, sm_lid, portp->portData->lid, &portInfo); if (status != VSTATUS_OK){ IB_LOG_WARN_FMT(__func__, "Cannot get PORTINFO for %s, TID="FMT_U64 @@ -889,6 +895,8 @@ static Status_t sa_Trap_Forward(SubscriberKeyp subsKeyp, STL_NOTICE * noticep) { IB_LOG_ERRORRC("sa_Trap_Forward: can't send MAD unreliably rc:", status); } } else { + // Set mad Data size + madcntxt->mad.datasize = (subsKeyp->ibMode ? sizeof(IB_NOTICE) : sizeof(STL_NOTICE)); // send notice out reliably if ((status = cs_cntxt_send_mad (madcntxt, &sm_notice_cntxt)) != VSTATUS_OK) { IB_LOG_ERRORRC("sa_Trap_Forward: can't send MAD reliably rc:", status); diff --git a/Esm/ib/src/smi/sa/sa_VLArbitrationRecord.c b/Esm/ib/src/smi/sa/sa_VLArbitrationRecord.c index 73fcde2d..fa1ebfc2 100755 --- a/Esm/ib/src/smi/sa/sa_VLArbitrationRecord.c +++ b/Esm/ib/src/smi/sa/sa_VLArbitrationRecord.c @@ -130,7 +130,7 @@ sa_VLArbitrationRecord(Mai_t *maip, sa_cntxt_t* sa_cntxt) { Status_t sa_VLArbitrationRecord_Set(uint8_t *vlarbp, Node_t *nodep, Port_t *portp, int ind) { - Lid_t lid; + STL_LID lid; STL_VLARBTABLE_RECORD vlArbRecord; if (portp == NULL) { diff --git a/Esm/ib/src/smi/sa/sa_main.c b/Esm/ib/src/smi/sa/sa_main.c index 3d0bec65..b3400541 100755 --- a/Esm/ib/src/smi/sa/sa_main.c +++ b/Esm/ib/src/smi/sa/sa_main.c @@ -571,13 +571,13 @@ sa_main_writer(uint32_t argc, uint8_t ** argv) { filter.mai_filter_check_packet = sa_writer_filter; MAI_SET_FILTER_NAME (&filter, "SA Writer"); - if (mai_filter_create(fd_sa_w, &filter, VFILTER_SHARE) != VSTATUS_OK) { + if (mai_filter_create(fd_sa_writer, &filter, VFILTER_SHARE) != VSTATUS_OK) { IB_LOG_ERROR0("esm_saw: can't create SubnAdm(*) filter"); (void)vs_thread_exit(&sm_threads[SM_THREAD_SA_WRITER].handle); } while (1) { - status = mai_recv(fd_sa_w, &in_mad, VTIMER_1S/4); + status = mai_recv(fd_sa_writer, &in_mad, VTIMER_1S/4); if (status != VSTATUS_OK && status != VSTATUS_TIMEOUT) { IB_LOG_ERRORRC("sa_main_writer: error on mai_recv rc:", status); vs_thread_sleep(VTIMER_1S/10); @@ -759,7 +759,7 @@ void sa_cntxt_age(void) // Touch the entry tout_cntxt->tstamp = timeLastAged ; // Call timeout - tout_cntxt->sendFd = fd_sa_w; // use sa writer mai handle for restransmits + tout_cntxt->sendFd = fd_sa_writer; // use sa writer mai handle for restransmits if (tout_cntxt->method == SA_CM_GETMULTI && tout_cntxt->reqInProg) { // resend the getMulti request ACK sa_getMulti_resend_ack(tout_cntxt); diff --git a/Esm/ib/src/smi/sa/sa_utility.c b/Esm/ib/src/smi/sa/sa_utility.c index a479250f..e511d2f9 100755 --- a/Esm/ib/src/smi/sa/sa_utility.c +++ b/Esm/ib/src/smi/sa/sa_utility.c @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT5 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -62,7 +62,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "sm_l.h" #include "sa_l.h" #include "sa_m.h" -#include "iba/stl_sa.h" +#include "iba/stl_sa_priv.h" #ifdef __VXWORKS__ #include "bspcommon/h/usrBootManager.h" #include "BootCfgMgr.h" @@ -242,7 +242,7 @@ sa_process_getmulti(Mai_t *maip, sa_cntxt_t* sa_cntxt) { /* get the request to processing routine */ sa_cntxt->processFunc((Mai_t *)&sa_cntxt->mad, sa_cntxt); /* switch the mai_handle to writer thread's now that we are sending rmpp response */ - sa_cntxt->sendFd = fd_sa_w; + sa_cntxt->sendFd = fd_sa_writer; } IB_EXIT("sa_process_getmulti", VSTATUS_OK); @@ -381,6 +381,9 @@ sa_process_mad(Mai_t *maip, sa_cntxt_t* sa_cntxt) { case STL_SA_ATTR_PGROUP_FWDTBL_RECORD: sa_PortGroupFwdRecord(maip, sa_cntxt); break; + case STL_SA_ATTR_SWITCH_COST_RECORD: + (void)sa_SwitchCostRecord(maip, sa_cntxt); + break; default: IB_LOG_INFINI_INFO_FMT( "sa_process_mad", "Unsupported or invalid %s[%s] request from LID [0x%x], TID["FMT_U64"]", @@ -396,7 +399,7 @@ sa_process_mad(Mai_t *maip, sa_cntxt_t* sa_cntxt) { * switch to sa writer mai handle for sending out remainder of rmpp responses * Mutipath request are set after complete receipt of requests in sa_process_getmulti */ - if (maip->base.aid != SA_MULTIPATH_RECORD) sa_cntxt->sendFd = fd_sa_w; + if (maip->base.aid != SA_MULTIPATH_RECORD) sa_cntxt->sendFd = fd_sa_writer; if (saDebugPerf) { /* use the time received from umadt as start time if available */ @@ -1700,10 +1703,10 @@ sa_cache_print_stats(void) //----------------------------------------------------------------------------// Status_t -sa_Authenticate_Path(Lid_t srcLid, Lid_t dstLid) { +sa_Authenticate_Path(STL_LID srcLid, STL_LID dstLid) { int i; int j; - Lid_t topLid; + STL_LID topLid; Node_t *nodep; Port_t *portp; Status_t status; @@ -1814,8 +1817,8 @@ sa_Authenticate_Path(Lid_t srcLid, Lid_t dstLid) { //------------------------------------------------------------------------------------------------// Status_t -sa_Authenticate_Access(uint32_t type, Lid_t srcLid, Lid_t dstLid, Lid_t reqLid) { - Lid_t topLid; +sa_Authenticate_Access(uint32_t type, STL_LID srcLid, STL_LID dstLid, STL_LID reqLid) { + STL_LID topLid; Node_t *nodep; Port_t *portp; Status_t status; @@ -1913,19 +1916,11 @@ sa_Compare_PKeys(STL_PKEY_ELEMENT *key1, STL_PKEY_ELEMENT *key2) { IB_ENTER("sa_Compare_PKeys", key1, key2, 0, 0); -// -// If there are no PKeys, then return good. -// - if ((key1[0].AsReg16 == 0) && (key2[0].AsReg16 == 0)) { - IB_EXIT("sa_Compare_PKeys", VSTATUS_OK); - return(VSTATUS_OK); - } - // // Loop over both arrays looking for at least one match. // - for (i = 0; (i < SM_PKEYS) && (key1[i].AsReg16 != 0); i++) { - for (j = 0; (j < SM_PKEYS) && (key2[j].AsReg16 != 0); j++) { + for (i = 0; (i < SM_PKEYS); i++) { + for (j = 0; (j < SM_PKEYS); j++) { if ((PKEY_VALUE(key1[i].AsReg16) == PKEY_VALUE(key2[j].AsReg16)) && ((PKEY_TYPE(key1[i].AsReg16) == PKEY_TYPE_FULL) || (PKEY_TYPE(key2[j].AsReg16) == PKEY_TYPE_FULL))) { @@ -2379,13 +2374,6 @@ int getDefBcGrp(uint16_t *pKey, uint8_t *mtu, uint8_t *rate, uint8_t *sl, uint32 Status_t sa_SetDefBcGrp(void) { - uint16_t pKey = 0; - uint8_t mtu = 0; - uint8_t rate = 0; - uint8_t sl = 0; - uint32_t qkey = 0; - uint32_t fl=0; - uint8_t tc=0; int vf; VFDg_t* mcastGrpp; VFAppMgid_t* mgidp; @@ -2394,13 +2382,6 @@ Status_t sa_SetDefBcGrp(void) { (void)vs_rdlock(&old_topology_lock); VirtualFabrics_t *VirtualFabrics = old_topology.vfs_ptr; - if (!VirtualFabrics || (VirtualFabrics->number_of_vfs == 0)) { - if(getDefBcGrp(&pKey, &mtu, &rate, &sl, &qkey, &fl, &tc)){ - createBroadcastGroup(pKey,mtu,rate,sl,qkey,fl,tc); - } - return VSTATUS_OK; - } - for (vf= 0; vf < VirtualFabrics->number_of_vfs && vf < MAX_VFABRICS; vf++) { for (mcastGrpp = VirtualFabrics->v_fabric[vf].default_group; mcastGrpp; mcastGrpp = mcastGrpp->next_default_group) { diff --git a/Esm/ib/src/smi/sm/Makefile b/Esm/ib/src/smi/sm/Makefile index 7705c8d8..2b92f253 100755 --- a/Esm/ib/src/smi/sm/Makefile +++ b/Esm/ib/src/smi/sm/Makefile @@ -50,7 +50,7 @@ CFILES = \ sm_shortestpath.c sm_fattree.c sm_dgrouting.c sm_counters.c \ sm_partMgr.c sm_qos.c sm_ar.c sm_jm.c sm_jm_wire.c \ sm_buffer_control_tables.c stl_cca.c sm_scvlmatrix.c \ - sm_hypercube.c sm_dor.c sm_activate.c + sm_hypercube.c sm_dor.c sm_activate.c sm_popo.c # Add more c files here ifeq ($(BUILD_TARGET_OS),VXWORKS) CFILES += sm_vxWorks.c diff --git a/Esm/ib/src/smi/sm/sm_activate.c b/Esm/ib/src/smi/sm/sm_activate.c index 75b93bf6..7ddb8c43 100644 --- a/Esm/ib/src/smi/sm/sm_activate.c +++ b/Esm/ib/src/smi/sm/sm_activate.c @@ -356,6 +356,8 @@ activate_switch_via_portinfo(Topology_t * topop, Node_t * nodep, pActivationRetr IB_LOG_WARN_FMT(__func__, "Failed to activate node %s nodeGuid "FMT_U64" port 0; status=%u", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, status); + if ((status = sm_popo_port_error(&sm_popo, sm_topop, portp, status)) == VSTATUS_TIMEOUT_LIMIT) + return status; } } @@ -378,6 +380,9 @@ activate_switch_via_portstateinfo(Topology_t * topop, Node_t * nodep, Port_t * p "Failed Set(PortStateInfo) for node %s nodeGuid "FMT_U64": status=%u", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, status); + if ((status = sm_popo_port_error(&sm_popo, sm_topop, port0p, status)) == VSTATUS_TIMEOUT_LIMIT) + return status; + // if Set failed, see if we can Get and take advantage of any ports // that succeeded status = sm_get_node_port_states(topop, nodep, port0p, NULL, &psi); @@ -386,6 +391,9 @@ activate_switch_via_portstateinfo(Topology_t * topop, Node_t * nodep, Port_t * p "Failed Get(PortStateInfo) for node %s nodeGuid "FMT_U64": status=%u", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, status); + if ((status = sm_popo_port_error(&sm_popo, sm_topop, port0p, status)) == VSTATUS_TIMEOUT_LIMIT) + return status; + // last resort... hit each port individually status = activate_switch_via_portinfo(topop, nodep, retry); IB_EXIT(__func__, status); @@ -427,6 +435,8 @@ activate_switch_via_portstateinfo(Topology_t * topop, Node_t * nodep, Port_t * p IB_LOG_WARN_FMT(__func__, "Failed to activate node %s nodeGuid "FMT_U64" port 0: status=%u", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, status); + if ((status = sm_popo_port_error(&sm_popo, sm_topop, portp, status)) == VSTATUS_TIMEOUT_LIMIT) + break; } } break; @@ -439,8 +449,8 @@ activate_switch_via_portstateinfo(Topology_t * topop, Node_t * nodep, Port_t * p vs_pool_free(&sm_pool, psi); - IB_EXIT(__func__, VSTATUS_OK); - return VSTATUS_OK; + IB_EXIT(__func__, status); + return status; } static Status_t @@ -474,6 +484,8 @@ activate_switch(Topology_t * topop, Node_t * nodep, pActivationRetry_t retry) IB_LOG_WARN_FMT(__func__, "Failed to activate node %s nodeGuid "FMT_U64" port 0: status=%u", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, status); + if ((status = sm_popo_port_error(&sm_popo, sm_topop, port0p, status)) == VSTATUS_TIMEOUT_LIMIT) + return status; } } @@ -501,6 +513,8 @@ activate_hfi(Topology_t * topop, Node_t * nodep, pActivationRetry_t retry) IB_LOG_WARN_FMT(__func__, "Failed to activate node %s nodeGuid "FMT_U64" port %u: status=%u", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, portp->index, status); + if ((status = sm_popo_port_error(&sm_popo, sm_topop, portp, status)) == VSTATUS_TIMEOUT_LIMIT) + return status; } } @@ -538,20 +552,23 @@ sm_activate_node_safe(Topology_t * topop, Node_t * nodep, pActivationRetry_t ret for_all_ports(nodep, portp) { if (!sm_valid_port(portp) || portp->state < IB_PORT_ARMED) continue; status = sm_activate_port(sm_topop, nodep, portp, FALSE, retry); - if (status != VSTATUS_OK) + if (status != VSTATUS_OK) { IB_LOG_WARN_FMT(__func__, "Failed to activate node %s nodeGuid "FMT_U64" port %u; status=%u", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, portp->index, status); + if ((status = sm_popo_port_error(&sm_popo, sm_topop, portp, status)) == VSTATUS_TIMEOUT_LIMIT) + return status; + } } IB_EXIT(__func__, status); return status; } -void +Status_t sm_arm_node(Topology_t * topop, Node_t * nodep) { - Status_t status; + Status_t status = VSTATUS_OK; Port_t *portp; for_all_ports(nodep, portp) { @@ -561,6 +578,8 @@ sm_arm_node(Topology_t * topop, Node_t * nodep) IB_LOG_ERROR_FMT(__func__, "TT(ta): can't ARM node %s nodeGuid "FMT_U64" node index %d port index %d", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, nodep->index, portp->index); sm_enable_port_led(nodep, portp, TRUE); + if ((status = sm_popo_port_error(&sm_popo, sm_topop, portp, status)) == VSTATUS_TIMEOUT_LIMIT) + return status; } else { bitset_clear(&nodep->initPorts, portp->index); } @@ -572,44 +591,53 @@ sm_arm_node(Topology_t * topop, Node_t * nodep) } } - if (nodep->nodeInfo.NodeType == NI_TYPE_SWITCH) { - // clear any pause state on switch doing adaptive routing - if (nodep->arSupport && nodep->switchInfo.AdaptiveRouting.s.Pause && !nodep->arDenyUnpause) { - // Setup was successful, clear pause - sm_SetARPause(nodep, 0) ; - } - } + return status; } -void +Status_t sm_activate_all_hfi_first_safe(Topology_t * topop, pActivationRetry_t retry) { + Status_t status = VSTATUS_OK; Node_t * nodep; for_all_ca_nodes(topop, nodep) - sm_activate_node_safe(topop, nodep, retry); + if ((status = sm_activate_node_safe(topop, nodep, retry)) == VSTATUS_TIMEOUT_LIMIT) + return status; for_all_switch_nodes(topop, nodep) - sm_activate_node_safe(topop, nodep, retry); + if ((status = sm_activate_node_safe(topop, nodep, retry)) == VSTATUS_TIMEOUT_LIMIT) + return status; + + return VSTATUS_OK; } -void +Status_t sm_activate_all_hfi_first(Topology_t * topop, pActivationRetry_t retry) { + Status_t status = VSTATUS_OK; Node_t * nodep; for_all_ca_nodes(topop, nodep) - sm_activate_node(topop, nodep, retry); + if ((status = sm_activate_node(topop, nodep, retry)) == VSTATUS_TIMEOUT_LIMIT) + return status; for_all_switch_nodes(topop, nodep) - sm_activate_node(topop, nodep, retry); + if ((status = sm_activate_node(topop, nodep, retry)) == VSTATUS_TIMEOUT_LIMIT) + return status; + + return VSTATUS_OK; } -void +Status_t sm_activate_all_switch_first(Topology_t * topop, pActivationRetry_t retry) { + Status_t status = VSTATUS_OK; Node_t * nodep; for_all_switch_nodes(topop, nodep) - sm_activate_node(topop, nodep, retry); + if ((status = sm_activate_node(topop, nodep, retry)) == VSTATUS_TIMEOUT_LIMIT) + return status; for_all_ca_nodes(topop, nodep) - sm_activate_node(topop, nodep, retry); + if ((status = sm_activate_node(topop, nodep, retry)) == VSTATUS_TIMEOUT_LIMIT) + return status; + + return VSTATUS_OK; } diff --git a/Esm/ib/src/smi/sm/sm_ar.c b/Esm/ib/src/smi/sm/sm_ar.c index 60d64ea2..b6ea525a 100644 --- a/Esm/ib/src/smi/sm/sm_ar.c +++ b/Esm/ib/src/smi/sm/sm_ar.c @@ -40,7 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FUNCTIONS // // LogPortGroupTable Log port groups // -// LogAdaptiveRoutingLidmask Log lid masks // +// LogPortGroupFwdTable Log port group FDB // // sm_AdaptiveRoutingSwitchUpdate Program AR tables // // // //======================================================================// @@ -86,7 +86,6 @@ sm_AdaptiveRoutingSwitchUpdate(Topology_t* topop, Node_t* switchp) { Status_t status = VSTATUS_OK; STL_LID_32 dlid; - uint8_t *path = NULL; if (!sm_adaptiveRouting.enable || !switchp->arSupport) return VSTATUS_OK; @@ -94,9 +93,8 @@ sm_AdaptiveRoutingSwitchUpdate(Topology_t* topop, Node_t* switchp) !switchp->arChange && bitset_equal(&old_switchesInUse, &new_switchesInUse) && bitset_test(&old_switchesInUse, switchp->swIdx)) { - Node_t *oldnodep; if (switchp->oldExists) { - oldnodep = switchp->old; + Node_t *oldnodep = switchp->old; if (oldnodep && oldnodep->arSupport && !oldnodep->arChange && @@ -105,10 +103,12 @@ sm_AdaptiveRoutingSwitchUpdate(Topology_t* topop, Node_t* switchp) return status; } } + // Set AR Change indicator. If this sweep fails too, + // carry forward to next sweep. + switchp->arChange = 1; } Port_t *portp = sm_get_port(switchp, 0); - path = NULL; dlid = portp->portData->lid; // Update the port group table. By definition, this will never take more @@ -135,7 +135,7 @@ sm_AdaptiveRoutingSwitchUpdate(Topology_t* topop, Node_t* switchp) // AMOD = # blocks 00 ------------ --00 0000 amod = blocks<<24; - status = SM_Set_PortGroup(fd_topology, amod, path, sm_lid, dlid, + status = SM_Set_PortGroup(fd_topology, amod, NULL, sm_lid, dlid, (STL_PORT_GROUP_TABLE*)switchp->pgt, blocks, sm_config.mkey); if (status != VSTATUS_OK) { @@ -148,7 +148,7 @@ sm_AdaptiveRoutingSwitchUpdate(Topology_t* topop, Node_t* switchp) // AMOD = last blks 00 ------------ --00 001f amod = ((blocks - MAX_PGT_BLOCK_NUM)<<24) | MAX_PGT_BLOCK_NUM; - status = SM_Set_PortGroup(fd_topology, amod, path, sm_lid, dlid, + status = SM_Set_PortGroup(fd_topology, amod, NULL, sm_lid, dlid, (STL_PORT_GROUP_TABLE*)&switchp->pgt[MAX_PGT_BLOCK_NUM*NUM_PGT_ELEMENTS_BLOCK], blocks, sm_config.mkey); @@ -184,7 +184,6 @@ sm_AdaptiveRoutingSwitchUpdate(Topology_t* topop, Node_t* switchp) IB_LOG_ERROR_FMT(__func__, "Could not allocate pgft for node %s nodeGuid "FMT_U64, sm_nodeDescString(switchp), switchp->nodeInfo.NodeGUID); status = VSTATUS_NOMEM; - switchp->arDenyUnpause = 1; return status; } @@ -201,7 +200,7 @@ sm_AdaptiveRoutingSwitchUpdate(Topology_t* topop, Node_t* switchp) // AMOD = NNNN NNNN 0000 0ABB BBBB BBBB BBBB BBBB // AMOD = numBlocks 0000 00[[[[[[current set]]]]] amod = (numBlocks<<24) | currentSet; - status = SM_Set_PortGroupFwdTable(fd_topology, amod, path, sm_lid, + status = SM_Set_PortGroupFwdTable(fd_topology, amod, NULL, sm_lid, dlid, (STL_PORT_GROUP_FORWARDING_TABLE*)&sm_Node_get_pgft_wr(switchp)[currentLid], numBlocks, sm_config.mkey); @@ -221,42 +220,19 @@ sm_AdaptiveRoutingSwitchUpdate(Topology_t* topop, Node_t* switchp) status = VSTATUS_EIO; } - // Set(SwitchInfo) to update PortGroupTop on the target switch - status = SM_Set_SwitchInfo(fd_topology, 0, switchp->path, &switchp->switchInfo, sm_config.mkey); - - if (status != VSTATUS_OK) { - switchp->arDenyUnpause = 1; - IB_LOG_WARN_FMT(__func__, - "Set(SwitchInfo) failed for node %s nodeGuid "FMT_U64, - sm_nodeDescString(switchp), switchp->nodeInfo.NodeGUID); - } - else { - switchp->arChange = 0; - switchp->arDenyUnpause = 0; - } - - return status; -} - -Status_t -sm_SetARPause(Node_t *switchp, uint8_t set) { - Status_t status; - - switchp->switchInfo.AdaptiveRouting.s.Pause = set ? 1 : 0; - - Port_t *portp = sm_get_port(switchp, 0); - sm_topop->slid = sm_lid; - sm_topop->dlid = portp->portData->lid; - - if ((status = SM_Set_SwitchInfo(fd_topology, 0, switchp->path, &switchp->switchInfo, sm_config.mkey)) != VSTATUS_OK) { - IB_LOG_WARN_FMT(__func__, "Failed to Set Switchinfo for node %s nodeGuid "FMT_U64": status = %d", - sm_nodeDescString(switchp), switchp->nodeInfo.NodeGUID, status); - } else { - switchp->switchInfo.AdaptiveRouting.s.Pause = set ? 1 : 0; - if (sm_adaptiveRouting.debug) { - IB_LOG_INFINI_INFO_FMT(__func__, - "Setting adaptive routing pause (%d) for switch %s guid "FMT_U64, - set, sm_nodeDescString(switchp), switchp->nodeInfo.NodeGUID); + if (status == VSTATUS_OK) { + // Set(SwitchInfo) to update PortGroupTop on the target switch + // and clear the pause + switchp->switchInfo.AdaptiveRouting.s.Pause = 0; + + status = SM_Set_SwitchInfo(fd_topology, 0, switchp->path, &switchp->switchInfo, sm_config.mkey); + if (status == VSTATUS_OK) { + switchp->arChange = 0; + } else { + switchp->switchInfo.AdaptiveRouting.s.Pause = 1; + IB_LOG_WARN_FMT(__func__, + "Set(SwitchInfo) failed for node %s nodeGuid "FMT_U64, + sm_nodeDescString(switchp), switchp->nodeInfo.NodeGUID); } } diff --git a/Esm/ib/src/smi/sm/sm_attribute.c b/Esm/ib/src/smi/sm/sm_attribute.c index 4dffd072..02f28afc 100755 --- a/Esm/ib/src/smi/sm/sm_attribute.c +++ b/Esm/ib/src/smi/sm/sm_attribute.c @@ -61,7 +61,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "sm_counters.h" #include "sm_l.h" #include "sa_l.h" -#include "iba/stl_sm.h" +#include "iba/stl_sm_priv.h" /** diff --git a/Esm/ib/src/smi/sm/sm_buffer_control_tables.c b/Esm/ib/src/smi/sm/sm_buffer_control_tables.c index 225beab6..87e9b300 100644 --- a/Esm/ib/src/smi/sm/sm_buffer_control_tables.c +++ b/Esm/ib/src/smi/sm/sm_buffer_control_tables.c @@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ib_status.h" #include "os_g.h" -#include "iba/stl_sm.h" +#include "iba/stl_sm_priv.h" #include "sm_l.h" static Status_t diff --git a/Esm/ib/src/smi/sm/sm_counters.c b/Esm/ib/src/smi/sm/sm_counters.c index 2198a4e0..9e4e4fa3 100644 --- a/Esm/ib/src/smi/sm/sm_counters.c +++ b/Esm/ib/src/smi/sm/sm_counters.c @@ -99,6 +99,8 @@ sm_counter_t smCounters[smCountersMax] = { [smCounterTrapBadPKey] = { "SM RX TRAP(BadPkey)", 0, 0, 0 }, [smCounterTrapBadQKey] = { "SM RX TRAP(BadQkey)", 0, 0, 0 }, [smCounterTrapBadPKeySwPort] = { "SM RX TRAP(BadPkeySwPort)", 0, 0, 0 }, + [smCounterTrapLinkWidthDowngrade] = { "SM RX TRAP(LinkWidthDowngrade)", 0, 0, 0 }, + [smCounterTrapCostMatrixChange] = { "SM RX TRAP(CostMatrixChange)", 0, 0, 0 }, [smCounterTrapsRepressed] = { "SM TX TRAPREPRESS(Notice)", 0, 0, 0 }, [smCounterGetNodeDescription] = { "SM TX GET(NodeDescription)", 0, 0, 0 }, diff --git a/Esm/ib/src/smi/sm/sm_dbsync.c b/Esm/ib/src/smi/sm/sm_dbsync.c index f50a1a28..d98ee3dd 100644 --- a/Esm/ib/src/smi/sm/sm_dbsync.c +++ b/Esm/ib/src/smi/sm/sm_dbsync.c @@ -191,7 +191,7 @@ sm_DbsyncRecCompare(void *key1, void *key2) { } -Status_t sm_dbsync_checksums(uint32_t vfCsum, uint32_t smCsum, uint32_t pmCsum, uint32_t feCsum) { +Status_t sm_dbsync_checksums(uint32_t vfCsum, uint32_t smCsum, uint32_t pmCsum) { Status_t status=VSTATUS_OK; if ((status = vs_lock(&smRecords.smLock)) != VSTATUS_OK) { @@ -201,7 +201,6 @@ Status_t sm_dbsync_checksums(uint32_t vfCsum, uint32_t smCsum, uint32_t pmCsum, smRecords.ourChecksums.smVfChecksum = vfCsum; smRecords.ourChecksums.smConfigChecksum = smCsum; smRecords.ourChecksums.pmConfigChecksum = pmCsum; - smRecords.ourChecksums.feConfigChecksum = feCsum; } (void)vs_unlock(&smRecords.smLock); return status; @@ -227,8 +226,7 @@ Status_t sm_dbsync_recInit(void) { // Don't need to lock old_topology, we are still running single threaded sm_dbsync_checksums(old_topology.vfs_ptr->consistency_checksum, sm_config.consistency_checksum, - pm_config.consistency_checksum, - fe_config.consistency_checksum); + pm_config.consistency_checksum); return status; } @@ -2331,7 +2329,7 @@ static void dbsync_procReqQ(void) { /* * see if remote SM still around */ -//static dbsync_pingSm(Lid_t lid) { +//static dbsync_pingSm(STL_LID lid) { // (void)if3_set_dlid(dbsyncfd_if3, lid); // /* ping the remote sm's dbsync thread */ // if(If3CntrlCmdSend(dbsyncfd_if3, FE_MNGR_PROBE_CMD) != VSTATUS_OK) { diff --git a/Esm/ib/src/smi/sm/sm_dbsync_util.c b/Esm/ib/src/smi/sm/sm_dbsync_util.c index 4d910ba2..c36c2812 100644 --- a/Esm/ib/src/smi/sm/sm_dbsync_util.c +++ b/Esm/ib/src/smi/sm/sm_dbsync_util.c @@ -55,9 +55,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "mai_g.h" #include "sm_l.h" #include "sa_l.h" -//#include "if3.h" -//#include "if3_def.h" -//#include "cs_queue.h" #include "sm_dbsync.h" #include "time.h" #ifdef __VXWORKS__ @@ -188,7 +185,7 @@ void sm_dbsync_initSmRec(SmRecp smrecp) { /* fill in the XML consistency check version and clear data */ smrecp->dbsyncCCC.protocolVersion = FM_PROTOCOL_VERSION; smrecp->dbsyncCCC.smVfChecksum = smrecp->dbsyncCCC.smConfigChecksum = 0; - smrecp->dbsyncCCC.pmConfigChecksum = smrecp->dbsyncCCC.feConfigChecksum = 0; + smrecp->dbsyncCCC.pmConfigChecksum = 0; smrecp->dbsyncCCC.spare1 = smrecp->dbsyncCCC.spare2 = smrecp->dbsyncCCC.spare3 = smrecp->dbsyncCCC.spare4 = 0; smrecp->dbsyncCCC.spare5 = smrecp->dbsyncCCC.spare6 = smrecp->dbsyncCCC.spare7 = smrecp->dbsyncCCC.spare8 = 0; } @@ -196,7 +193,7 @@ void sm_dbsync_initSmRec(SmRecp smrecp) { /* * send sync request on sync queue to db_sync thread */ -void sm_dbsync_queueMsg(DBSyncType_t syncType, DBSyncDatTyp_t syncDataTye, Lid_t lid, Guid_t portguid, uint8_t isEmbedded, SMSyncData_t data) { +void sm_dbsync_queueMsg(DBSyncType_t syncType, DBSyncDatTyp_t syncDataTye, STL_LID lid, Guid_t portguid, uint8_t isEmbedded, SMSyncData_t data) { SMSyncReqp srp; Status_t status; @@ -771,13 +768,6 @@ Status_t sm_dbsync_configCheck(SmRecKey_t recKey, SMDBCCCSyncp smSyncSetting) { condition = CSM_COND_SECONDARY_PM_DEACTIVATION; smrecp->syncCapability = DBSYNC_CAP_NOTSUPPORTED; } - if (smSyncSetting->feConfigChecksum != smRecords.ourChecksums.feConfigChecksum) { - IB_LOG_WARN_FMT(__func__, - "SM at %s, portGuid="FMT_U64" detected a different FE configuration consistency checksum [%u] from us [%u]", - smrecp->nodeDescString, recKey, smSyncSetting->feConfigChecksum, smRecords.ourChecksums.feConfigChecksum); - - mismatchDetected = 1; - } if (mismatchDetected) { IB_LOG_WARN_FMT(__func__, diff --git a/Esm/ib/src/smi/sm/sm_dgrouting.c b/Esm/ib/src/smi/sm/sm_dgrouting.c index a38f08a5..ca21f67f 100644 --- a/Esm/ib/src/smi/sm/sm_dgrouting.c +++ b/Esm/ib/src/smi/sm/sm_dgrouting.c @@ -95,8 +95,9 @@ dgmh_pre_process_discovery(Topology_t *topop, void **outContext) MAX_VFABRIC_NAME); dgp->deviceGroupName[i][MAX_VFABRIC_NAME]=0; if ((dgIndex = smGetDgIdx(dgp->deviceGroupName[i])) < 0) { - IB_LOG_ERROR_FMT(__func__, "DGMinHopTopology has undefined RoutingOrder DeviceGroup %s", + IB_LOG_ERROR_FMT(__func__,"DGMinHopTopology has undefined RoutingOrder DeviceGroup %s", dgp->deviceGroupName[i]); + IB_FATAL_ERROR_NODUMP("FM cannot continue."); return VSTATUS_BAD; } dgp->deviceGroupIndex[i] = dgIndex; @@ -313,6 +314,8 @@ dgmh_calculate_lft(Topology_t * topop, Node_t * switchp) return status; } + // Initialize port group top prior to setting up groups. + switchp->switchInfo.PortGroupTop = 0; IB_LOG_DEBUG4_FMT(__func__, "Building LFT for 0x%"PRIx64, switchp->nodeInfo.NodeGUID); diff --git a/Esm/ib/src/smi/sm/sm_dispatch.c b/Esm/ib/src/smi/sm/sm_dispatch.c index c7f54249..7c51af01 100644 --- a/Esm/ib/src/smi/sm/sm_dispatch.c +++ b/Esm/ib/src/smi/sm/sm_dispatch.c @@ -52,6 +52,7 @@ static void sm_dispatch_cntxt_callback(cntxt_entry_t *cntxt, Status_t cntxtStatu sm_dispatch_req_t *req = (sm_dispatch_req_t *)data; sm_dispatch_t *disp = req->disp; Node_t *nodep = NULL; + uint64_t now; if (req->sweepPasscount == disp->sweepPasscount) { nodep = req->nodep; @@ -61,6 +62,11 @@ static void sm_dispatch_cntxt_callback(cntxt_entry_t *cntxt, Status_t cntxtStatu cntxt->lid, cntxt->mad.base.aid, cntxt->mad.base.amod); } + if (cntxtStatus == VSTATUS_TIMEOUT) { + vs_time_get(&now); + sm_popo_report_timeout(&sm_popo, MAX(0, now - req->sendTime)); + } + if (cntxt && cntxt->mad.base.aid == MAD_SMA_LFT) { if (cntxtStatus == VSTATUS_TIMEOUT) { if (nodep) { @@ -138,6 +144,8 @@ static Status_t sm_dispatch_send(sm_dispatch_req_t *req) sm_newTopology.dlid = req->sendParams.dlid; } + vs_time_get(&req->sendTime); + if (req->sendParams.bversion == STL_BASE_VERSION) { return sm_send_stl_request_impl( req->sendParams.fd, req->sendParams.method, req->sendParams.aid, @@ -343,23 +351,24 @@ void sm_dispatch_bump_passcount(sm_dispatch_t *disp) cs_cntxt_unlock(&sm_async_send_rcv_cntxt); } -Status_t sm_dispatch_clear(sm_dispatch_t *disp) +static void _dispatch_clear_unsafe(sm_dispatch_t *disp) { LIST_ITEM *item; sm_dispatch_req_t *req; - cs_cntxt_lock(&sm_async_send_rcv_cntxt); - item = QListRemoveHead(&disp->queue); while (item != NULL) { req = (sm_dispatch_req_t *)QListObj(item); sm_dispatch_free_req(req); item = QListRemoveHead(&disp->queue); } +} +void sm_dispatch_clear(sm_dispatch_t *disp) +{ + cs_cntxt_lock(&sm_async_send_rcv_cntxt); + _dispatch_clear_unsafe(disp); cs_cntxt_unlock(&sm_async_send_rcv_cntxt); - - return VSTATUS_OK; } Status_t sm_dispatch_update(sm_dispatch_t *disp) @@ -377,9 +386,15 @@ Status_t sm_dispatch_update(sm_dispatch_t *disp) return VSTATUS_OK; } + if (sm_popo_should_abandon(&sm_popo)) { + _dispatch_clear_unsafe(disp); + cs_cntxt_unlock(&sm_async_send_rcv_cntxt); + return VSTATUS_OK; + } + if (disp->reqsOutstanding >= disp->reqsSupported) { cs_cntxt_unlock(&sm_async_send_rcv_cntxt); -// IB_LOG_INFINI_INFO0("maximum requests outstanding"); + IB_LOG_VERBOSE_FMT(__func__, "maximum requests outstanding"); return VSTATUS_OK; } @@ -389,7 +404,7 @@ Status_t sm_dispatch_update(sm_dispatch_t *disp) item = QListNext(&disp->queue, item); if ((disp->sweepPasscount != req->sweepPasscount) || (req->nodep->asyncReqsOutstanding < req->nodep->asyncReqsSupported)) { -// IB_LOG_INFINI_INFO0("servicing incoming queue"); + IB_LOG_VERBOSE_FMT(__func__, "servicing incoming queue"); QListRemoveItem(&disp->queue, &req->item); ++disp->reqsOutstanding; if (disp->sweepPasscount == req->sweepPasscount) ++req->nodep->asyncReqsOutstanding; diff --git a/Esm/ib/src/smi/sm/sm_dor.c b/Esm/ib/src/smi/sm/sm_dor.c index a8f6fbca..1e6d0bb1 100644 --- a/Esm/ib/src/smi/sm/sm_dor.c +++ b/Esm/ib/src/smi/sm/sm_dor.c @@ -407,16 +407,9 @@ _create_dimension(DorDiscoveryState_t *state, int configDim, DorTopology_t *dorT { Status_t status; DorDimension_t *dim; - int i, j, index; + int i, j, index = 0; int8_t direction = 0; - // add forward direction - status = vs_pool_alloc(&sm_pool, sizeof(*dim), (void *)&dim); - if (status != VSTATUS_OK) { - IB_LOG_ERRORRC("Failed to allocate dimension data structure; rc:", status); - return status; - } - for (i = 0; i < smDorRouting.dimensionCount; i++) { for (j = 0; j < smDorRouting.dimension[i].portCount; j++) { if (p == smDorRouting.dimension[i].portPair[j].port1) { @@ -437,6 +430,13 @@ _create_dimension(DorDiscoveryState_t *state, int configDim, DorTopology_t *dorT return VSTATUS_BAD; } + // add forward direction + status = vs_pool_alloc(&sm_pool, sizeof(*dim), (void *)&dim); + if (status != VSTATUS_OK) { + IB_LOG_ERRORRC("Failed to allocate dimension data structure; rc:", status); + return status; + } + //check if this dimension is configured as toroidal if (is_configured_toroidal(p, q)) { _mark_toroidal_dimension(state, dorTop, index); @@ -444,13 +444,15 @@ _create_dimension(DorDiscoveryState_t *state, int configDim, DorTopology_t *dorT dorTop->dimensionLength[index] = smDorRouting.dimension[index].length; - dorTop->coordMinimums[index] = !dorTop->toroidal[index] ? 0 : (0 - + dorTop->coordMinimums[index] = !dorTop->toroidal[index] ? (0 - (dorTop->dimensionLength[index] - 1)) : (0 - (dorTop->dimensionLength[index] / 2) + (dorTop->dimensionLength[index]%2 ? 0 : 1)); dorTop->coordMaximums[index] = !dorTop->toroidal[index] ? (dorTop->dimensionLength[index] - 1) : (dorTop->dimensionLength[index] / 2); + dorTop->measuredMaximums[index] = 0; + dorTop->measuredMinimums[index] = 0; // check direction int nextCoord = dorNodep->coords[index] + direction; @@ -827,9 +829,15 @@ _propagate_coord_through_port(DorDiscoveryState_t *state, } else { neighborDorNode->coords[dim->dimension] += dim->direction; + if (dim->direction > 0) + dorTop->measuredMaximums[dim->dimension] = neighborDorNode->coords[dim->dimension]; + else + dorTop->measuredMinimums[dim->dimension] = neighborDorNode->coords[dim->dimension]; if ((neighborDorNode->coords[dim->dimension] < dorTop->coordMinimums[dim->dimension]) || - (neighborDorNode->coords[dim->dimension] > dorTop->coordMaximums[dim->dimension])) { + (neighborDorNode->coords[dim->dimension] > dorTop->coordMaximums[dim->dimension]) || + ((dorTop->measuredMaximums[dim->dimension] - dorTop->measuredMinimums[dim->dimension]) >= + dorTop->dimensionLength[dim->dimension])) { char b1[32], b2[32]; _coord_to_string(topop, dorNode->coords, b1); _coord_to_string(topop, neighborDorNode->coords, b2); @@ -1701,7 +1709,6 @@ _setup_pgfdb(struct _Topology *topop, struct _Node * srcSw, struct _Node * dstSw } if (endPort <= 1) { - srcSw->switchInfo.PortGroupTop = 0; return VSTATUS_OK; } @@ -1726,7 +1733,7 @@ _setup_pgfdb(struct _Topology *topop, struct _Node * srcSw, struct _Node * dstSw if (rc >= 0) { srcSw->arChange |= (rc > 0); - srcSw->switchInfo.PortGroupTop = srcSw->pgtLen; //MAX(srcSw->switchInfo.PortGroupTop, srcSw->pgtLen); + srcSw->switchInfo.PortGroupTop = srcSw->pgtLen; //PGFT is independent of LFT with LMC, though it's supposed to re-use the LMC data PORT * pgft = sm_Node_get_pgft_wr(srcSw); @@ -1802,7 +1809,6 @@ _setup_pgs(struct _Topology *topop, struct _Node * srcSw, struct _Node * dstSw) endPort = topop->routingModule->funcs.get_port_group(topop, srcSw, dstSw, portGroup); if (endPort <= 1) { - srcSw->switchInfo.PortGroupTop = 0; return VSTATUS_OK; } @@ -1842,11 +1848,25 @@ _get_dor_port_group(Topology_t *topop, Node_t *switchp, Node_t* toSwitchp, uint8 } if (ijTest(dorTop->dorLeft, ij)) { - _add_ports(switchp, srcDnp->left[routingDim]->node, ordered_ports, &count); + if (srcDnp->left[routingDim]->node) { + _add_ports(switchp, srcDnp->left[routingDim]->node, ordered_ports, &count); + } else { + IB_LOG_ERROR_FMT(__func__, "Invalid DOR closure in dimension %d dor left" + " 0x%016"PRIx64" [%s] does not connect to 0x%016"PRIx64 " [%s]", + routingDim, switchp->nodeInfo.NodeGUID, sm_nodeDescString(switchp), + toSwitchp->nodeInfo.NodeGUID, sm_nodeDescString(toSwitchp)); + } } if (ijTest(dorTop->dorRight, ij)) { - _add_ports(switchp, srcDnp->right[routingDim]->node, ordered_ports, &count); + if (srcDnp->right[routingDim]->node) { + _add_ports(switchp, srcDnp->right[routingDim]->node, ordered_ports, &count); + } else { + IB_LOG_ERROR_FMT(__func__, "Invalid DOR closure in dimension %d dor right" + " 0x%016"PRIx64" [%s] does not connect to 0x%016"PRIx64 " [%s]", + routingDim, switchp->nodeInfo.NodeGUID, sm_nodeDescString(switchp), + toSwitchp->nodeInfo.NodeGUID, sm_nodeDescString(toSwitchp)); + } } qsort(ordered_ports, count, sizeof(SwitchportToNextGuid_t), _compare_lids_routed); @@ -1866,7 +1886,9 @@ _get_port_group(Topology_t *topop, Node_t *switchp, Node_t *toSwitchp, uint8_t * if (dorClosure(dorTop, switchp->swIdx, toSwitchp->swIdx)) { count = _get_dor_port_group(topop, switchp, toSwitchp, portnos); - } else { + } + + if (!count) { count = _get_alternate_path_port_group(topop, switchp, toSwitchp, portnos); } @@ -1917,6 +1939,9 @@ _calculate_lft(Topology_t * topop, Node_t *switchp) if (smDorRouting.debug) IB_LOG_INFINI_INFO_FMT(__func__, "Switch %s", sm_nodeDescString(switchp)); + // Initialize port group top prior to setting up groups. + switchp->switchInfo.PortGroupTop = 0; + for_all_switch_nodes(topop, toSwitchp) { i = 0; if (switchp == toSwitchp) { @@ -2052,8 +2077,7 @@ _pre_process_discovery(Topology_t *topop, void **outContext) dorTop = (DorTopology_t*)topop->routingModule->data; memset(dorTop, 0, sizeof(DorTopology_t)); - status = vs_pool_alloc(&sm_pool, sizeof(DorDiscoveryState_t), - (void *)&state); + status = vs_pool_alloc(&sm_pool, sizeof(DorDiscoveryState_t), (void *)&state); if (status != VSTATUS_OK) { IB_LOG_ERRORRC("Failed to allocate up/down state; rc:", status); return status; @@ -2648,16 +2672,14 @@ static Status_t _process_swIdx_change(Topology_t * topop, int old_idx, int new_i if (dorTop->dorLeft != NULL) { if (ijTest(dorTop->dorLeft, oldij)) { ijSet(dorTop->dorLeft, ij); - //reset old index value to 0 as it is no longer valid - dorTop->dorLeft[oldij >> 5] &= ~((uint32_t)(1 << (ij & 0x1f))); + ijClear(dorTop->dorLeft, oldij); } else { ijClear(dorTop->dorLeft, ij); } if (ijTest(dorTop->dorLeft, oldji)) { ijSet(dorTop->dorLeft, ji); - //reset old index value to 0 - dorTop->dorLeft[oldji >> 5] &= ~((uint32_t)(1 << (ji & 0x1f))); + ijClear(dorTop->dorLeft, oldji); } else { ijClear(dorTop->dorLeft, ji); } @@ -2666,16 +2688,14 @@ static Status_t _process_swIdx_change(Topology_t * topop, int old_idx, int new_i if (dorTop->dorRight != NULL) { if (ijTest(dorTop->dorRight, oldij)) { ijSet(dorTop->dorRight, ij); - //reset old index value to 0 as it is no longer valid - dorTop->dorRight[oldij >> 5] &= ~((uint32_t)(1 << (ij & 0x1f))); + ijClear(dorTop->dorRight, oldij); } else { ijClear(dorTop->dorRight, ij); } if (ijTest(dorTop->dorRight, oldji)) { ijSet(dorTop->dorRight, ji); - //reset old index value to 0 - dorTop->dorRight[oldji >> 5] &= ~((uint32_t)(1 << (ji & 0x1f))); + ijClear(dorTop->dorRight, oldji); } else { ijClear(dorTop->dorRight, ji); } @@ -2684,16 +2704,14 @@ static Status_t _process_swIdx_change(Topology_t * topop, int old_idx, int new_i if (dorTop->dorBroken != NULL) { if (ijTest(dorTop->dorBroken, oldij)) { ijSet(dorTop->dorBroken, ij); - //reset old index value to 0 as it is no longer valid - dorTop->dorBroken[oldij >> 5] &= ~((uint32_t)(1 << (ij & 0x1f))); + ijClear(dorTop->dorBroken, oldij); } else { ijClear(dorTop->dorBroken, ij); } if (ijTest(dorTop->dorBroken, oldji)) { ijSet(dorTop->dorBroken, ji); - //reset old index value to 0 - dorTop->dorBroken[oldji >> 5] &= ~((uint32_t)(1 << (ji & 0x1f))); + ijClear(dorTop->dorBroken, oldji); } else { ijClear(dorTop->dorBroken, ji); } @@ -2720,18 +2738,20 @@ extern McSpanningTree_t **uniqueSpanningTrees; // dnodep - current node, assumed to have already been added to the tree. // dneighborp - a neighbor of dnodep, which will become a child of dnodep in // the spanning tree. -// dim - the dimension we're working on. -// isLeft - true if dneighborp is on the left of dnodep in dimension dim. // static int _add_neighbor_to_tree(McSpanningTree_t *dorTree, DorNode_t *dnodep, - DorNode_t *dneighborp, unsigned dim, unsigned isLeft) + DorNode_t *dneighborp) { Node_t *nodep = dnodep->node; Node_t *nnodep = dneighborp->node; Port_t *portp = NULL; unsigned i, j, k, p; + unsigned numPorts; + uint8_t egressPorts[255]; // Note that OPA spec says we can't have more + // than 255 ports. + i = _lookup_index(dneighborp->coords); j = _lookup_index(dnodep->coords); @@ -2744,28 +2764,45 @@ _add_neighbor_to_tree(McSpanningTree_t *dorTree, DorNode_t *dnodep, DEBUG_ASSERT(dnodep->node->nodeInfo.NodeType == STL_NODE_SW); DEBUG_ASSERT(dneighborp->node->nodeInfo.NodeType == STL_NODE_SW); - for (k = 0; portp == NULL && k < smDorRouting.dimension[dim].portCount; - k++) { - if (isLeft) { - // If we're looking at the left neighbor, then traffic flows - // from our port2 ports to the neighbor's port1 ports. - // Find the first working port2. - p = smDorRouting.dimension[dim].portPair[k].port2; - } else { - // If we're looking at the right neighbor, then traffic flows - // from our port1 ports to the neighbor's port2 ports. - // Find the first working port1. - p = smDorRouting.dimension[dim].portPair[k].port1; - } + numPorts = sm_topop->routingModule->funcs.get_port_group(sm_topop, nodep, + nnodep, egressPorts); + + for (k = 0; portp == NULL && k < numPorts; k++) { + p = egressPorts[k]; portp = sm_get_port(nodep, p); - if (!sm_valid_port(portp) || portp->state < IB_PORT_ACTIVE) { + + if (!portp) { + IB_LOG_DEBUG1_FMT(__func__, "Expected link between 0x%016"PRIx64" [%s]:%u and " + "0x%016"PRIx64" [%s] not found - port not found in topology.", + nodep->nodeInfo.NodeGUID, sm_nodeDescString(nodep), p, + nnodep->nodeInfo.NodeGUID, sm_nodeDescString(nnodep)); + IB_LOG_DEBUG1_FMT(__func__, "portIndex = %u, NumPorts = %u", + p, nodep->nodeInfo.NumPorts); + } else if (!portp->portData) { + IB_LOG_DEBUG1_FMT(__func__, "Expected link between 0x%016"PRIx64" [%s]:%u and " + "0x%016"PRIx64" [%s] port data for port %u is missing.", + nodep->nodeInfo.NodeGUID, sm_nodeDescString(nodep), p, + nnodep->nodeInfo.NodeGUID, sm_nodeDescString(nnodep), p); + IB_LOG_DEBUG1_FMT(__func__, "Port state for 0x%016"PRIx64" [%s]:%u is %u ", + nodep->nodeInfo.NodeGUID, sm_nodeDescString(nodep), p, portp->state); + portp = NULL; + } else if (portp->state < IB_PORT_ACTIVE) { + IB_LOG_DEBUG1_FMT(__func__, "Expected link between 0x%016"PRIx64" [%s]:%u and " + "0x%016"PRIx64" [%s] not found - port in state %u", + nodep->nodeInfo.NodeGUID, sm_nodeDescString(nodep), p, + nnodep->nodeInfo.NodeGUID, sm_nodeDescString(nnodep), portp->state); portp = NULL; + } else { + IB_LOG_DEBUG1_FMT(__func__, "Found valid link between 0x%016"PRIx64" [%s]:%u and " + "0x%016"PRIx64" [%s].", + nodep->nodeInfo.NodeGUID, sm_nodeDescString(nodep), p, + nnodep->nodeInfo.NodeGUID, sm_nodeDescString(nnodep)); } } if (!portp) { // No link between these neighbors. Cannot span. - IB_LOG_INFINI_INFO_FMT(__func__, "Unable to complete spanning tree. " + IB_LOG_DEBUG1_FMT(__func__, "Disrupted DOR MC spanning tree. " "No connections between 0x%016"PRIx64" and 0x%016"PRIx64, nodep->nodeInfo.NodeGUID, nnodep->nodeInfo.NodeGUID); return 0; @@ -2910,7 +2947,7 @@ _build_spanning_tree_branch(DorTopology_t *dorTop, McSpanningTree_t *dorTree, break; } - if (!_add_neighbor_to_tree(dorTree, dnodep, dneighborp, dim, 1)) { + if (!_add_neighbor_to_tree(dorTree, dnodep, dneighborp)) { // Broken link. break; } @@ -2947,7 +2984,7 @@ _build_spanning_tree_branch(DorTopology_t *dorTop, McSpanningTree_t *dorTree, break; } - if (!_add_neighbor_to_tree(dorTree, dnodep, dneighborp, dim, 0)) { + if (!_add_neighbor_to_tree(dorTree, dnodep, dneighborp)) { // Broken link. break; } @@ -2977,7 +3014,7 @@ _build_spanning_tree_branch(DorTopology_t *dorTop, McSpanningTree_t *dorTree, break; } - if (!_add_neighbor_to_tree(dorTree, dnodep, dneighborp, dim, 0)) { + if (!_add_neighbor_to_tree(dorTree, dnodep, dneighborp)) { // Broken link. break; } @@ -3004,7 +3041,7 @@ _build_spanning_tree_branch(DorTopology_t *dorTop, McSpanningTree_t *dorTree, break; } - if (!_add_neighbor_to_tree(dorTree, dnodep, dneighborp, dim, 1)) { + if (!_add_neighbor_to_tree(dorTree, dnodep, dneighborp)) { // Broken link. break; } @@ -3192,8 +3229,6 @@ _build_spanning_trees(void) for (i=0; i < dorTree->num_nodes; i++) { DorNode_t *bestp = NULL; - unsigned best_dim = 0; - unsigned is_left = 0; McNode_t *mnodep = &(dorTree->nodes[i]); int8_t height = 64; // max distance a node can be from the SM. @@ -3228,8 +3263,6 @@ _build_spanning_trees(void) if (dorTree->nodes[s].height < height && dorTree->nodes[s].height >= 0) { bestp = lp; - best_dim = j; - is_left = 0; height = dorTree->nodes[s].height; } } @@ -3239,16 +3272,13 @@ _build_spanning_trees(void) if (dorTree->nodes[s].height < height && dorTree->nodes[s].height >= 0) { bestp = rp; - best_dim = j; - is_left = 1; height = dorTree->nodes[s].height; } } } if (bestp) { // Add dnodep to the tree with bestp as the parent. - if (_add_neighbor_to_tree(dorTree, bestp, dnodep, - best_dim, is_left)) { + if (_add_neighbor_to_tree(dorTree, bestp, dnodep)) { progress = 1; } } diff --git a/Esm/ib/src/smi/sm/sm_fattree.c b/Esm/ib/src/smi/sm/sm_fattree.c index b16394b0..4337877b 100644 --- a/Esm/ib/src/smi/sm/sm_fattree.c +++ b/Esm/ib/src/smi/sm/sm_fattree.c @@ -31,6 +31,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ib_types.h" #include "sm_l.h" +int fattreeBadSweepCount = 0; +int rebalanceGoodSweep = 0; + Status_t sm_shortestpath_make_routing_module(RoutingModule_t * rm); static __inline__ void @@ -307,9 +310,24 @@ _post_process_discovery(Topology_t *topop, Status_t discoveryStatus, void *conte } if (processedSwitches.nset_m != new_switchesInUse.nset_m) { - IB_LOG_ERROR_FMT(__func__, "Switch(es) unassigned to/out-of-bound (fattree) tier. Check TierCount in config file."); - return VSTATUS_BAD; + // Bad config or edge switch with no HFIs online. + if (sm_config.ftreeRouting.fis_on_same_tier) { + IB_LOG_WARN_FMT(__func__, "Switch(es) unassigned to/out-of-bound (fattree) tier. All HFIs offline on edge switch or check TierCount in config file."); + + // When all HFIs come online, force rebalance of fabric. + fattreeBadSweepCount++; + + } else { + IB_LOG_WARN_FMT(__func__, "Switch(es) unassigned to/out-of-bound (fattree) tier. Check fattree configuration."); + } + + } else if (fattreeBadSweepCount) { + // Looks like HFIs have been enabled on edge switch, force a rebalance this sweep + // instead of calculating deltas. + fattreeBadSweepCount = 0; + rebalanceGoodSweep = 1; } + bitset_free(&processedSwitches); return VSTATUS_OK; @@ -375,6 +393,9 @@ _calculate_balanced_lfts_systematic(Topology_t *topop) IB_LOG_ERROR_FMT(__func__, "Failed to allocate space for LFT."); return status; } + + // Initialize port group top prior to setting up groups. + switchp->switchInfo.PortGroupTop = 0; } // if route last is indicated, balance over those HFIs on a second pass @@ -503,6 +524,8 @@ _calculate_balanced_lfts_systematic(Topology_t *topop) } else { // Switch may not be added to tier switch group when no FIs in down path. // If so, doesn't matter if it is balanced. + if (sm_config.sm_debug_routing) + IB_LOG_INFINI_INFO_FMT(__func__, "Switch %s is not queued", sm_nodeDescString(switchp)); topop->routingModule->funcs.calculate_routes(sm_topop, switchp); } } @@ -695,11 +718,13 @@ _init_switch_lfts(Topology_t * topop, int * routing_needed, int * rebalance) if (topop != sm_topop) return VSTATUS_BAD; - if (topology_cost_path_changes || *rebalance) { + if (topology_cost_path_changes || *rebalance || rebalanceGoodSweep) { // A topology change was indicated. Re-calculate lfts with big hammer (rebalance). s = _calculate_balanced_lfts_systematic(topop); *rebalance = 1; + *routing_needed = 1; routing_recalculated = 1; + rebalanceGoodSweep = 0; } else if ( new_endnodesInUse.nset_m || old_topology.num_endports != topop->num_endports) { diff --git a/Esm/ib/src/smi/sm/sm_fsm.c b/Esm/ib/src/smi/sm/sm_fsm.c index d55b36c8..de2f8f19 100755 --- a/Esm/ib/src/smi/sm/sm_fsm.c +++ b/Esm/ib/src/smi/sm/sm_fsm.c @@ -399,8 +399,8 @@ sm_fsm_standby(Mai_t *maip, char *nodename) long new_state=-1; STL_SM_INFO theirSmInfo; STL_SM_INFO smInfoCopy; - Lid_t slid=maip->addrInfo.slid; // original source lid; mai_reply swaps slid-dlid - Lid_t dlid=maip->addrInfo.dlid; // original destination lid(us); mai_reply swaps slid-dlid + STL_LID slid=maip->addrInfo.slid; // original source lid; mai_reply swaps slid-dlid + STL_LID dlid=maip->addrInfo.dlid; // original destination lid(us); mai_reply swaps slid-dlid IB_ENTER(__func__, maip->base.amod, 0, 0, 0); @@ -560,8 +560,8 @@ sm_fsm_master(Mai_t *maip, char *nodename) uint8_t *path; int i, wakeTpThread=0; STL_SM_INFO smInfoCopy; - Lid_t slid=maip->addrInfo.slid; // original source lid; mai_reply swaps slid-dlid - Lid_t dlid=maip->addrInfo.dlid; // original destination lid(us); mai_reply swaps slid-dlid + STL_LID slid=maip->addrInfo.slid; // original source lid; mai_reply swaps slid-dlid + STL_LID dlid=maip->addrInfo.dlid; // original destination lid(us); mai_reply swaps slid-dlid IB_ENTER(__func__, maip->base.amod, sm_state, 0, 0); @@ -669,7 +669,7 @@ sm_fsm_discovering(Mai_t *maip, char *nodename) { Status_t status; STL_SM_INFO theirSmInfo; - Lid_t slid=maip->addrInfo.slid; // original source lid; mai_reply swaps slid-dlid + STL_LID slid=maip->addrInfo.slid; // original source lid; mai_reply swaps slid-dlid IB_ENTER(__func__, maip->base.amod, sm_state, 0, 0); diff --git a/Esm/ib/src/smi/sm/sm_hypercube.c b/Esm/ib/src/smi/sm/sm_hypercube.c index 2be0271d..a73b5203 100644 --- a/Esm/ib/src/smi/sm/sm_hypercube.c +++ b/Esm/ib/src/smi/sm/sm_hypercube.c @@ -893,6 +893,9 @@ hypercube_calculate_all_lfts(Topology_t * topop) IB_LOG_ERROR_FMT(__func__, "Failed to allocate space for LFT."); return status; } + + // Initialize port group top prior to setting up groups. + switchp->switchInfo.PortGroupTop = 0; } // if route last is indicated, balance over those HFIs on a second pass @@ -1018,6 +1021,9 @@ hypercube_calculate_lft(Topology_t * topop, Node_t * switchp) return status; } + // Initialize port group top prior to setting up groups. + switchp->switchInfo.PortGroupTop = 0; + // if route last is indicated, balance over those HFIs on a second pass routingIterations = (strlen(sm_config.hypercubeRouting.routeLast.member) == 0) ? 1 : 2; diff --git a/Esm/ib/src/smi/sm/sm_linux.c b/Esm/ib/src/smi/sm/sm_linux.c index 280c207a..c8cf8cad 100755 --- a/Esm/ib/src/smi/sm/sm_linux.c +++ b/Esm/ib/src/smi/sm/sm_linux.c @@ -560,8 +560,9 @@ uint8_t if3_is_master(void) return sm_isMaster(); } -void if3_set_rmpp_minfo (ManagerInfo_t *mi) +Status_t if3_set_rmpp_minfo (ManagerInfo_t *mi) { + Status_t rc = VSTATUS_OK; // Default, RMPP filters required in order for thread to receive inbound // MAD requests mi->rmppCreateFilters = 1; @@ -580,6 +581,7 @@ void if3_set_rmpp_minfo (ManagerInfo_t *mi) if (tname == NULL) { IB_LOG_INFINI_INFO_FMT(__func__, "Error unnamed thread"); + rc = VSTATUS_BAD; } else if (!strcmp(tname, "fe")) { mi->rmppMngrfd = &fd_pm; mi->rmppPool = &fe_pool; @@ -593,6 +595,7 @@ void if3_set_rmpp_minfo (ManagerInfo_t *mi) } else { IB_LOG_INFINI_INFO_FMT(__func__, "Error unknown thread %s", tname); + rc = VSTATUS_BAD; } } break; @@ -606,9 +609,11 @@ void if3_set_rmpp_minfo (ManagerInfo_t *mi) mi->rmppMaxCntxt = sa_max_cntxt; break; default: + rc = VSTATUS_ILLPARM; IB_LOG_INFINI_INFO_FMT(__func__, "MCLASS 0x%x not supported", mi->mclass); break; } + return rc; } /* diff --git a/Esm/ib/src/smi/sm/sm_main.c b/Esm/ib/src/smi/sm/sm_main.c index 134f9551..e219efda 100755 --- a/Esm/ib/src/smi/sm/sm_main.c +++ b/Esm/ib/src/smi/sm/sm_main.c @@ -66,6 +66,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef __VXWORKS__ #include +#include #endif #ifdef CAL_IBACCESS @@ -261,9 +262,10 @@ VirtualFabrics_t *initialVfPtr = NULL; VirtualFabrics_t *updatedVirtualFabrics = NULL; IBhandle_t fd_sa; -IBhandle_t fd_sa_w; +IBhandle_t fd_sa_writer; IBhandle_t fd_saTrap; IBhandle_t fd_async; +IBhandle_t fd_async_request; IBhandle_t fd_sminfo; IBhandle_t fd_topology; IBhandle_t fd_atopology; @@ -649,7 +651,7 @@ sm_resolve_pkeys_for_vfs(VirtualFabrics_t *VirtualFabrics) sm_masterSmSl = VirtualFabrics->v_fabric[vf].base_sl; } } - if (smCheckServiceId(vf, PM_SERVICE_ID, VirtualFabrics)) { + if (smCheckServiceId(vf, STL_PM_SERVICE_ID, VirtualFabrics)) { if (PKEY_VALUE(VirtualFabrics->v_fabric[vf].pkey) != DEFAULT_PKEY) { IB_LOG_ERROR_FMT_VF(VirtualFabrics->v_fabric[vf].name, __func__, "VFabric has application PA selected, bad PKey configured 0x%x, must use Mgmt PKey.", @@ -882,6 +884,14 @@ Status_t sm_parse_xml_config(void) { } sm_init_log_setting(); vs_log_output_message("Subnet Manager starting up.", TRUE); +#ifndef __VXWORKS__ + vs_log_output(VS_LOG_NONE, VIEO_NONE_MOD_ID, NULL, NULL, + "SM: Version: %s", GetCodeVersion()); + //vs_log_output(VS_LOG_NONE, VIEO_NONE_MOD_ID, NULL, NULL, + // "SM: IntVersion: %s", GetCodeInternalVersion()); + //vs_log_output(VS_LOG_NONE, VIEO_NONE_MOD_ID, NULL, NULL, + // "SM: Brand: %s", GetCodeBrand()); +#endif // Print out XML SM debug settings that could really break SM if ((sm_config.forceAttributeRewrite!=0) || (sm_config.skipAttributeWrite!=0)) { @@ -1670,8 +1680,8 @@ sm_main(void) { } // used by the SA to handle RMPP responses and acks - if ((status = mai_open(1, sm_config.hca, sm_config.port, &fd_sa_w)) != VSTATUS_OK) { - IB_FATAL_ERROR_NODUMP("can't open fd_sa_w"); + if ((status = mai_open(1, sm_config.hca, sm_config.port, &fd_sa_writer)) != VSTATUS_OK) { + IB_FATAL_ERROR_NODUMP("can't open fd_sa_writer"); } // used by the notice async context to handle SA reports (notices) @@ -1684,6 +1694,11 @@ sm_main(void) { IB_FATAL_ERROR_NODUMP("can't open fd_async"); } + // used by the SA (via async thread) to handle outbound queries (e.g. PortInfo in response to traps) + if ((status = mai_open(0, sm_config.hca, sm_config.port, &fd_async_request)) != VSTATUS_OK) { + IB_FATAL_ERROR_NODUMP("can't open fd_async_request"); + } + // used by the fsm (via async thread) for SMInfo and PortInfo GETs if ((status = mai_open(0, sm_config.hca, sm_config.port, &fd_sminfo)) != VSTATUS_OK) { IB_FATAL_ERROR_NODUMP("can't open fd_sminfo"); @@ -1711,7 +1726,8 @@ sm_main(void) { } IB_LOG_INFO("fd_sa", fd_sa); - IB_LOG_INFO("fd_sa_w", fd_sa_w); + IB_LOG_INFO("fd_sa_writer", fd_sa_writer); + IB_LOG_INFO("fd_async_request", fd_async_request); IB_LOG_INFO("fd_saTrap", fd_saTrap); IB_LOG_INFO("fd_async", fd_async); IB_LOG_INFO("fd_sminfo", fd_sminfo); @@ -2181,7 +2197,6 @@ smProcessReconfigureRequest(void){ } if (configChanged) { - //Verify that no disruptive checksums have changed if (!sm_config_valid(new_xml_config, newVirtualFabrics, oldVirtualFabrics) || !pm_config_valid(new_xml_config)) { @@ -2216,14 +2231,17 @@ smProcessReconfigureRequest(void){ savedVfConsistencyChecksum = updatedVirtualFabrics->consistency_checksum; + //check if activating or deactivating a VF cause changes in mcgroups + IB_LOG_INFINI_INFO0("SM: Checking changes in MC groups"); + sm_update_mc_groups( newVirtualFabrics, oldVirtualFabrics); + // Allow sweeps to run (void)vs_unlock(&new_topology_lock); /* Update our consistency checksums */ sm_dbsync_checksums(savedVfConsistencyChecksum, new_xml_config->fm_instance[sm_instance]->sm_config.consistency_checksum, - new_xml_config->fm_instance[sm_instance]->pm_config.consistency_checksum, - new_xml_config->fm_instance[sm_instance]->fe_config.consistency_checksum + new_xml_config->fm_instance[sm_instance]->pm_config.consistency_checksum ); sm_config.overall_checksum = new_xml_config->fm_instance[sm_instance]->sm_config.overall_checksum; pm_config.overall_checksum = new_xml_config->fm_instance[sm_instance]->pm_config.overall_checksum; diff --git a/Esm/ib/src/smi/sm/sm_multicast.c b/Esm/ib/src/smi/sm/sm_multicast.c index de18ca04..0590f932 100755 --- a/Esm/ib/src/smi/sm/sm_multicast.c +++ b/Esm/ib/src/smi/sm/sm_multicast.c @@ -66,7 +66,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "iba/ib_helper.h" - __inline__ int find_mlid_offset(Lid_t mLid) { return(mLid & STL_LID_MCAST_OFFSET_MASK); @@ -568,7 +567,189 @@ findFirstPortInMftBlock(STL_PORTMASK *mftBlock, int blockPos) { #define Mft_Position(X) ((X)/STL_PORT_MASK_WIDTH) #define Mft_PortmaskBit(X) ((uint64)1 << (X)%STL_PORT_MASK_WIDTH) +static Status_t sm_createMCastGrp(int vf, uint64_t* mgid, uint16_t pkey, uint8_t mtu, uint8_t rate, uint8_t sl, uint32_t qkey, uint32_t fl, uint8_t tc) { + + Status_t status; + McGroup_t *mcGroup; + McMember_t *mcMember = NULL; + STL_MCMEMBER_RECORD *mcmp; + Lid_t mLid; + IB_GID mGid; + + + if ((status = sm_multicast_assign_lid(mGid, pkey, mtu, rate, &mLid)) != VSTATUS_OK) { + sysPrintf("Failed to allocate LID for Multicast group!\n"); + return status; + } + McGroup_Create(mcGroup); //create register and add it to structure + + mcGroup->mGid.AsReg64s.H = mgid[0]; + mcGroup->mGid.AsReg64s.L = mgid[1]; + mcGroup->mLid = mLid; + mcGroup->qKey = qkey; + mcGroup->pKey = pkey; + mcGroup->mtu = mtu; + mcGroup->rate = rate; + mcGroup->life = sa_dynamicPlt[0] ? sa_dynamicPlt[9] : sm_config.sa_packet_lifetime_n2; + mcGroup->sl = sl; + mcGroup->tClass = tc; + mcGroup->hopLimit = 0xFF; + mcGroup->scope = IB_LINK_LOCAL_SCOPE; + mcGroup->members_full = 1; + bitset_set(&mcGroup->vfMembers, vf); + //also add dummy McMember + McMember_Create(mcGroup, mcMember); + mcMember->slid = 0; + mcMember->proxy = 1; + mcMember->state = MCMEMBER_JOIN_FULL_MEMBER; + mcMember->nodeGuid = 0; + mcMember->portGuid = SA_FAKE_MULTICAST_GROUP_MEMBER; + + //create STL_MCMEMBER_RECORD + mcmp = &mcMember->record; + mcmp->RID.MGID.AsReg64s.H = mgid[0]; + mcmp->RID.MGID.AsReg64s.L = mgid[1]; + + memset((void*)mcmp->RID.PortGID.Raw, 0, sizeof(mcmp->RID.PortGID)); + mcmp->Q_Key = mcGroup->qKey; + mcmp->MLID = mcGroup->mLid; + mcmp->MtuSelector= PR_EQ; + mcmp->Mtu = mcGroup->mtu; + mcmp->TClass = mcGroup->tClass; + mcmp->P_Key = mcGroup->pKey; + mcmp->RateSelector = PR_EQ; + mcmp->Rate = mcGroup->rate; + mcmp->PktLifeTimeSelector = PR_EQ; + mcmp->PktLifeTime = mcGroup->life; + mcmp->SL = mcGroup->sl; + mcmp->HopLimit = mcGroup->hopLimit; + mcmp->Scope = mcGroup->scope; + mcmp->JoinFullMember = mcMember->state & MCMEMBER_JOIN_FULL_MEMBER; + mcmp->JoinNonMember = 0; + mcmp->JoinSendOnlyMember = 0; + mcmp->ProxyJoin = mcMember->proxy; + + return VSTATUS_OK; +} + +Status_t sm_update_mc_groups(VirtualFabrics_t *newVF, VirtualFabrics_t *oldVF) +{ + McGroup_t *mcGroup, *tmpGroup; + McMember_t *mcMember; + uint32_t vf; + VFDg_t *dg_ref; + VFAppMgid_t *mgid_ref; + cl_map_item_t *item1; + Status_t status; + IB_GID mGid; + + if ((status = vs_wrlock(&old_topology_lock)) != VSTATUS_OK) + return status; + + if ((status = vs_lock(&sm_McGroups_lock)) != VSTATUS_OK) { + vs_unlock(&old_topology_lock); + return status; + } + + for (vf=0; vf < newVF->number_of_vfs_all; vf++) { + //order in v_fabric_all remains same when changing status (Active/Standby) + // from old to new. + // swap from standby to active + if ((newVF->v_fabric_all[vf].standby == 0) && (oldVF->v_fabric_all[vf].standby == 1)) { + // add if necessary mcgroups + IB_LOG_INFINI_INFO_FMT(__func__, + "VF %s change from STB to ACT ",newVF->v_fabric_all[vf].name ); + //compare groups and if it is not there add it. + dg_ref = newVF->v_fabric_all[vf].default_group; + while (dg_ref) { + if (dg_ref->def_mc_create) { + for_all_qmap_ptr(&dg_ref->mgidMap, item1, mgid_ref) { + mGid.Type.Global.SubnetPrefix = mgid_ref->mgid[0]; + mGid.Type.Global.InterfaceID = mgid_ref->mgid[1]; + mcGroup = sm_find_multicast_gid(mGid); + + if (!mcGroup) { + uint8_t sl; + //assigning the newVF's SL. For now it did not change dynamically. + if (newVF->v_fabric_all[vf].mcast_sl != UNDEFINED_XML8) + sl = newVF->v_fabric_all[vf].mcast_sl; + else sl = newVF->v_fabric_all[vf].base_sl; + status = sm_createMCastGrp(vf, mgid_ref->mgid, dg_ref->def_mc_pkey, dg_ref->def_mc_mtu_int, + dg_ref->def_mc_rate_int, sl ,dg_ref->def_mc_qkey, dg_ref->def_mc_fl, dg_ref->def_mc_tc); + if (status == VSTATUS_OK) { + IB_LOG_INFINI_INFO_FMT(__func__, "Creating multicast MGID: "FMT_GID, mgid_ref->mgid[0], mgid_ref->mgid[1]); + } + else IB_LOG_INFINI_INFO_FMT(__func__, "Not able to create group MGID: "FMT_GID, mgid_ref->mgid[0], mgid_ref->mgid[1]); + } + else { + IB_LOG_INFINI_INFO_FMT(__func__," Multicast group exists MGID: "FMT_GID, mgid_ref->mgid[0], mgid_ref->mgid[1]); + bitset_set(&mcGroup->vfMembers, vf); // add current VF to the mgid + } + } + } + dg_ref = dg_ref->next_default_group; + } + } // end transition STB-> ACT + + // VF transitions from active to standby + if ((newVF->v_fabric_all[vf].standby == 1) && (oldVF->v_fabric_all[vf].standby == 0)) { + IB_LOG_INFINI_INFO_FMT(__func__, "VF %s change from ACT to STB ", newVF->v_fabric_all[vf].name ); + + //delete if necessary mcgroups + mcGroup = sm_McGroups; + while (mcGroup) { + if (bitset_test(&mcGroup->vfMembers, vf)) { + //find members in VF + mcMember = mcGroup->mcMembers; + for_all_multicast_members(mcGroup, mcMember) { + uint64_t mcMemberGuid; + Port_t *portp; + mcMemberGuid = mcGroup->mcMembers->record.RID.PortGID.Type.Global.InterfaceID; + if (mcMemberGuid != 0) { + if ((portp = sm_find_port_guid(&old_topology, mcGroup->mcMembers->portGuid)) != NULL) { + if (bitset_test(&portp->portData->vfMember,vf)) { + IB_LOG_INFINI_INFO_FMT(__func__, "VF %s port_guid "FMT_U64" moved to STB\n", + oldVF->v_fabric_all[vf].name, mcGroup->mcMembers->portGuid); + //mark node that is not a member + if (portp->portData->portInfo.PortStates.s.PortState == IB_PORT_ACTIVE) { + // Indicate that reregistration is pending; will persist across + // sweeps until it succeeds or is no longer required (e.g. state change) + portp->portData->reregisterPending = 1; + } + bitset_clear(&portp->portData->vfMember,vf); + } + } + } + } + //reset bit for that VF + bitset_clear(&mcGroup->vfMembers, vf); + } + // if there is no other VF matching, check it has no members and then delete it + if (bitset_nset(&mcGroup->vfMembers)== 0) { + while (mcGroup->mcMembers) { + // MUST copy head pointer into temp + // Passing mcGroup->members directly to the delete macro will corrupt the list + mcMember = mcGroup->mcMembers; + McMember_Delete(mcGroup, mcMember); + } + if (mcGroup->mcMembers == NULL) { // Group is empty, delete it + IB_LOG_INFINI_INFO_FMT(__func__, "VF %s. Group is empty, deleting MGID: "FMT_GID, newVF->v_fabric_all[vf].name, mcGroup->mGid.Type.Global.SubnetPrefix, mcGroup->mGid.Type.Global.InterfaceID); + tmpGroup = mcGroup->next; + McGroup_Delete(mcGroup); + mcGroup = tmpGroup; + } + } + else + mcGroup = mcGroup->next; + } // while mcGroup ends + } // if end + } // for all vfs end + status = VSTATUS_OK; + vs_unlock(&sm_McGroups_lock); + vs_unlock(&old_topology_lock); + return status; +} /* sm_check_mc_groups_realizable - checks multicast groups to see if they have become unrealizable * due to topology/mtu/rate changes, or if for some other reason we did not compute a valid spanning * tree and marks such groups as unrealizable. @@ -805,7 +986,6 @@ Status_t sm_calculate_mfts() sm_check_mc_groups_realizable(); - sm_calculate_spanning_tree_port_mask(); /* Copy the spanning tree port mask to all the MLIDs from tree->first_mlid where diff --git a/Esm/ib/src/smi/sm/sm_partMgr.c b/Esm/ib/src/smi/sm/sm_partMgr.c index 00a4c20a..84daff2c 100755 --- a/Esm/ib/src/smi/sm/sm_partMgr.c +++ b/Esm/ib/src/smi/sm/sm_partMgr.c @@ -363,19 +363,22 @@ sm_set_portPkey(Topology_t *topop, Node_t *nodep, Port_t *portp, * IB spec 10.9.2 C10-120 requirement - switch external ports won't * have pkey tables if switchInfo->enforcementcap is zero, so don't ask */ - if ((nodep->nodeInfo.NodeType == NI_TYPE_SWITCH && portp->index == 0 && nodep->nodeInfo.PartitionCap) || - (nodep->nodeInfo.NodeType == NI_TYPE_SWITCH && portp->index > 0 && nodep->switchInfo.PartitionEnforcementCap) || - (nodep->nodeInfo.NodeType == NI_TYPE_CA)) + if (is_hfiport(portp) || + (is_swport0(portp) && nodep->nodeInfo.PartitionCap) || + (is_extswport(portp) && nodep->switchInfo.PartitionEnforcementCap)) { - amod = nodep->nodeInfo.NodeType == NI_TYPE_SWITCH ? portp->index << 16 : 0; - /* for switch port0, FIs, and routers, partitionCap is in nodep->nodeInfo.PartitionCap */ - if ( (nodep->nodeInfo.NodeType == NI_TYPE_SWITCH && portp->index == 0) || - (nodep->nodeInfo.NodeType != NI_TYPE_SWITCH) ) { + amod = is_swport(portp) ? portp->index << 16 : 0; + /* for switch port0 and FIs, partitionCap is in nodep->nodeInfo.PartitionCap + * Otherwise, for switch external ports, use switchInfo->partCap. + */ + if ( is_swport0(portp) || is_hfiport(portp) ) pkeyCap = nodep->nodeInfo.PartitionCap; - } else { - /* for switch external ports, use switchInfo->partCap */ + else pkeyCap = nodep->switchInfo.PartitionEnforcementCap; - } + + /* non-ISL (i.e. SW<->HFI, HFI<->HFI) links should not use more pkeys than their neighbor. */ + if (linkedPortp && !portp->portData->isIsl) + pkeyCap = MIN(pkeyCap, linkedPortp->portData->nodePtr->nodeInfo.PartitionCap); if (pkeyCap < pkeyEntryCntr) { if (*enforcePkey) { @@ -854,21 +857,68 @@ smGetValidatedServiceIDVFs(Port_t* srcport, Port_t* dstport, uint16_t pkey, uint // Is this the proper vf? if ((pkey != 0) && (PKEY_VALUE(pkey) != PKEY_VALUE(VirtualFabrics->v_fabric[vf].pkey))) continue; - // One is full? - if (srcport != dstport && - !bitset_test(&srcport->portData->fullPKeyMember, vfIdx) && - !bitset_test(&dstport->portData->fullPKeyMember, vfIdx)) continue; - - // Are both src and dst part of this VF? - if (!bitset_test(&srcport->portData->vfMember, vfIdx)) continue; - if (!bitset_test(&dstport->portData->vfMember, vfIdx)) continue; - // Are these the proper sls? if ((reqSL < STL_MAX_SLS) && (reqSL != VirtualFabrics->v_fabric[vf].base_sl)) continue; if ((respSL < STL_MAX_SLS) && (respSL != VirtualFabrics->v_fabric[vf].resp_sl)) continue; - bitset_set(vfs, vf); + + if (sm_config.enforceVFPathRecs) { + // One is full? + if (srcport != dstport && + !bitset_test(&srcport->portData->fullPKeyMember, vfIdx) && + !bitset_test(&dstport->portData->fullPKeyMember, vfIdx)) continue; + + // Are both src and dst part of this VF? + if (!bitset_test(&srcport->portData->vfMember, vfIdx)) continue; + if (!bitset_test(&dstport->portData->vfMember, vfIdx)) continue; + + bitset_set(vfs, vf); + } + else { + + // If we are not checking that the src/dst ports are in the same VF, + // then need to check that pkey shared between the source and destination ports + int vf2; + Port_t* tstport = 0; + if (srcport == dstport) tstport = dstport; + else if (bitset_test(&srcport->portData->fullPKeyMember, vfIdx)) tstport = dstport; + else if (bitset_test(&dstport->portData->fullPKeyMember, vfIdx)) tstport = srcport; + + if (tstport == 0) continue; // Case where neither port is a full member of this VF + + uint16_t tstpkey = VirtualFabrics->v_fabric[vf].pkey; + uint8_t tstSL = VirtualFabrics->v_fabric[vf].base_sl; + uint8_t tstrspSL = VirtualFabrics->v_fabric[vf].resp_sl; + + for (vf2 = 0; vf2 < VirtualFabrics->number_of_vfs && vf2 < MAX_VFABRICS; vf2++) { + // Check for service ID + if (smCheckServiceId(vf2, serviceId, VirtualFabrics)) { + if (!appFound) { + // Outer loop is using unmatched, exit this loop because this vf will be found later in outer loop. + break; + } + } else if (appFound || !VirtualFabrics->v_fabric[vf2].apps.select_unmatched_sid) { + // Two cases to skip: + // App is found and no service ID match on this vf, continue to next vf. + // Unmatched is in use and this vf is not using unmatched. + continue; + } + + // To have a path between VFs, the VFs must share the same PKEY and Base SL + // (AND Response SL if either VF requires Response SLs). Only need to check + // base SL b/c rules for SL sharing requires consistent pairing among VFs + if (PKEY_VALUE(tstpkey) != PKEY_VALUE(VirtualFabrics->v_fabric[vf2].pkey)) continue; + if (tstSL != VirtualFabrics->v_fabric[vf2].base_sl) continue; + if ((VirtualFabrics->v_fabric[vf].requires_resp_sl || VirtualFabrics->v_fabric[vf2].requires_resp_sl) && + tstrspSL != VirtualFabrics->v_fabric[vf2].resp_sl) continue; + + vfIdx=VirtualFabrics->v_fabric[vf2].index; + if (bitset_test(&tstport->portData->vfMember, vfIdx)) { + bitset_set(vfs, vf2); + } + } + } } return VSTATUS_OK; @@ -878,30 +928,62 @@ smGetValidatedServiceIDVFs(Port_t* srcport, Port_t* dstport, uint16_t pkey, uint Status_t smGetValidatedVFs(Port_t* srcport, Port_t* dstport, uint16_t pkey, uint8_t reqSL, uint8_t respSL, bitset_t* vfs) { // TODO consolidate with smGetValidatedServiceIDVFs() - int vf; + int vf, vfIdx; VirtualFabrics_t *VirtualFabrics = old_topology.vfs_ptr; for (vf = 0; vf < VirtualFabrics->number_of_vfs; vf++) { - uint32 vfIdx=VirtualFabrics->v_fabric[vf].index; // Is this the proper vf? if ((pkey != 0) && (PKEY_VALUE(pkey) != PKEY_VALUE(VirtualFabrics->v_fabric[vf].pkey))) continue; - // One is full? - if (srcport != dstport && - !bitset_test(&srcport->portData->fullPKeyMember, vfIdx) && - !bitset_test(&dstport->portData->fullPKeyMember, vfIdx)) continue; - - // Are both src and dst part of this VF? - if (!bitset_test(&srcport->portData->vfMember, vfIdx)) continue; - if (!bitset_test(&dstport->portData->vfMember, vfIdx)) continue; - // Are these the proper sls? if ((reqSL < STL_MAX_SLS) && (reqSL != VirtualFabrics->v_fabric[vf].base_sl)) continue; if ((respSL < STL_MAX_SLS) && (respSL != VirtualFabrics->v_fabric[vf].resp_sl)) continue; + vfIdx=VirtualFabrics->v_fabric[vf].index; + + if (sm_config.enforceVFPathRecs) { + // One is full? + if ( + (srcport != dstport) && !bitset_test(&srcport->portData->fullPKeyMember, vfIdx) && + !bitset_test(&dstport->portData->fullPKeyMember, vfIdx)) continue; + + // Are both src and dst part of this VF? + if (!bitset_test(&srcport->portData->vfMember, vfIdx)) continue; + if (!bitset_test(&dstport->portData->vfMember, vfIdx)) continue; + + bitset_set(vfs, vf); + } + else { + + // If we are not checking that the src/dst ports are in the same VF, + // then need to check that pkey shared between the source and destination ports + int vf2; + Port_t* tstport = 0; + if (bitset_test(&srcport->portData->fullPKeyMember, vfIdx)) tstport = dstport; + else if (bitset_test(&dstport->portData->fullPKeyMember, vfIdx)) tstport = srcport; + if (tstport == 0) { + if (srcport == dstport) + tstport = srcport; // Loopback case + else + continue; // Case where neither port is a full member of this VF + } + + uint16_t tstpkey = VirtualFabrics->v_fabric[vf].pkey; + uint8_t tstSL = VirtualFabrics->v_fabric[vf].base_sl; + + for (vf2 = 0; vf2 < VirtualFabrics->number_of_vfs && vf2 < MAX_VFABRICS; vf2++) { + // To have a path between VFs, the VFs must share the same PKEY AND Base SL + // Only need to check base SL b/c rules for SL sharing requires consistent pairing among VFs + if (PKEY_VALUE(tstpkey) != PKEY_VALUE(VirtualFabrics->v_fabric[vf2].pkey)) continue; + if (tstSL != VirtualFabrics->v_fabric[vf2].base_sl) continue; - bitset_set(vfs, vf); + vfIdx=VirtualFabrics->v_fabric[vf2].index; + if (bitset_test(&tstport->portData->vfMember, vfIdx)) { + bitset_set(vfs, vf2); + } + } + } } return VSTATUS_OK; @@ -1065,6 +1147,7 @@ smVFValidateMcGrpCreateParams(Port_t * joiner, Port_t * requestor, mgidInVF = 1; mgidFound = 1; bitset_set(groupVf, vf); + break; } } diff --git a/Esm/ib/src/smi/sm/sm_popo.c b/Esm/ib/src/smi/sm/sm_popo.c new file mode 100644 index 00000000..9eb88ed0 --- /dev/null +++ b/Esm/ib/src/smi/sm/sm_popo.c @@ -0,0 +1,332 @@ +/* BEGIN_ICS_COPYRIGHT7 **************************************** + +Copyright (c) 2015-2017, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +** END_ICS_COPYRIGHT7 ****************************************/ + +#include "sm_l.h" + +static void +_popo_lock(Popo_t * popop) +{ + if (vs_lock(&popop->lock) != VSTATUS_OK) + IB_FATAL_ERROR_NODUMP("failed to lock popo"); +} + +static void +_popo_unlock(Popo_t * popop) +{ + if (vs_unlock(&popop->lock) != VSTATUS_OK) + IB_FATAL_ERROR_NODUMP("failed to unlock popo"); +} + +// Garbage collects a persistent port. +// +static void +_popo_gc_port(Popo_t * popop, PopoPort_t * poportp) +{ + switch (poportp->quarantine.type) { + case POPO_QUARANTINE_NONE: + break; + case POPO_QUARANTINE_SHORT: + QListRemoveItem(&popop->quarantine.shortTerm, &poportp->quarantine.entry); + break; + } +} + +// Garbage collects a persistent node. +// +static void +_popo_gc_node(Popo_t * popop, PopoNode_t * ponodep) +{ + int i; + + for (i = 0; i < ponodep->info.numPorts; ++i) { + PopoPort_t * poportp = ponodep->ports + i; + _popo_gc_port(popop, poportp); + } + + cl_qmap_remove_item(&popop->nodes, &ponodep->nodesEntry); + + vs_pool_free(&sm_pool, ponodep); +} + +// Garbage collect persistent nodes if they've not been seen +// after some number of sweeps. +// +static void +_popo_gc(Popo_t * popop, boolean force) +{ + PopoNode_t * ponodep; + cl_map_item_t * i, * j; + uint32_t pass = topology_passcount; + + _popo_lock(popop); + + for (i = cl_qmap_head(&popop->nodes); i && i != cl_qmap_end(&popop->nodes); i = j) { + j = cl_qmap_next(i); + ponodep = PARENT_STRUCT(i, PopoNode_t, nodesEntry); + if (ponodep && (force || pass - ponodep->info.pass > MAX(2, sm_config.non_resp_max_count))) + _popo_gc_node(popop, ponodep); + } + + _popo_unlock(popop); +} + +void +sm_popo_init(Popo_t * popop) +{ + if (vs_lock_init(&popop->lock, VLOCK_FREE, VLOCK_THREAD) != VSTATUS_OK) + IB_FATAL_ERROR_NODUMP("failed to init popo lock"); + + cl_qmap_init(&popop->nodes, NULL); + popop->errors.cumulativeTimeout = 0; + QListInit(&popop->quarantine.shortTerm); +} + +void +sm_popo_destroy(Popo_t * popop) +{ + _popo_gc(popop, TRUE); + vs_lock_delete(&popop->lock); + memset(popop, 0, sizeof(Popo_t)); +} + +void +sm_popo_report(Popo_t * popop) +{ + _popo_lock(popop); + IB_LOG_INFINI_INFO_FMT(__func__, "short term quarantine: %u", + QListCount(&popop->quarantine.shortTerm)); + _popo_unlock(popop); +} + +PopoNode_t * +sm_popo_get_node(Popo_t * popop, const STL_NODE_INFO * nodeInfo) +{ + Status_t status; + PopoNode_t * ponodep; + size_t len; + + _popo_lock(popop); + + cl_map_item_t * item = cl_qmap_get(&popop->nodes, nodeInfo->NodeGUID); + if (item == cl_qmap_end(&popop->nodes)) { + len = sizeof(PopoNode_t) + sizeof(PopoPort_t) * (nodeInfo->NumPorts + 1); + if ((status = vs_pool_alloc(&sm_pool, len, (void **)&ponodep)) != VSTATUS_OK) + IB_FATAL_ERROR_NODUMP("failed to allocate persistent port"); + memset(ponodep, 0, len); + ponodep->info.pass = topology_passcount; + ponodep->info.nodeType = nodeInfo->NodeType; + ponodep->info.numPorts = nodeInfo->NumPorts; + if (cl_qmap_insert(&popop->nodes, nodeInfo->NodeGUID, &ponodep->nodesEntry) != &ponodep->nodesEntry) + IB_FATAL_ERROR_NODUMP("failed to insert persistent port into map"); + } else { + ponodep = PARENT_STRUCT(item, PopoNode_t, nodesEntry); + } + + _popo_unlock(popop); + return ponodep; +} + +PopoPort_t * +sm_popo_get_port(Popo_t * popop, PopoNode_t * ponodep, uint8_t port) +{ + PopoPort_t * poportp; + + _popo_lock(popop); + + if (port > ponodep->info.numPorts) { + _popo_unlock(popop); + return NULL; + } + + poportp = ponodep->ports + port; + poportp->ponodep = ponodep; + + _popo_unlock(popop); + return poportp; +} + +boolean +sm_popo_is_port_quarantined(Popo_t * popop, Port_t * portp) +{ + return sm_valid_port(portp) && portp->poportp->quarantine.type != POPO_QUARANTINE_NONE; +} + +// An entire switch is considered quarantined if port zero is quarantined. +// +boolean +sm_popo_is_node_quarantined(Popo_t * popop, uint64_t guid) +{ + _popo_lock(popop); + + cl_map_item_t * item = cl_qmap_get(&popop->nodes, guid); + if (item == cl_qmap_end(&popop->nodes)) { + _popo_unlock(popop); + return FALSE; + } + + PopoNode_t * ponodep = PARENT_STRUCT(item, PopoNode_t, nodesEntry); + boolean q = ponodep->info.nodeType == NI_TYPE_SWITCH && + ponodep->ports[0].quarantine.type != POPO_QUARANTINE_NONE; + + _popo_unlock(popop); + + return q; +} + +static void +sm_popo_quarantine_port_unsafe(Popo_t * popop, PopoPort_t * poportp, PopoQuarantineType_t type) +{ + PopoQuarantineType_t prevType = poportp->quarantine.type; + if (prevType == type) + return; + + switch (prevType) { + case POPO_QUARANTINE_NONE: + break; + case POPO_QUARANTINE_SHORT: + QListRemoveItem(&popop->quarantine.shortTerm, &poportp->quarantine.entry); + break; + } + + poportp->quarantine.type = type; + + switch (type) { + case POPO_QUARANTINE_NONE: + break; + case POPO_QUARANTINE_SHORT: + QListInsertTail(&popop->quarantine.shortTerm, &poportp->quarantine.entry); + break; + } +} + +void +sm_popo_quarantine_port(Popo_t * popop, Port_t * portp, PopoQuarantineType_t type) +{ + DEBUG_ASSERT(type != POPO_QUARANTINE_NONE); + + if (!sm_valid_port(portp)) return; + + _popo_lock(popop); + sm_popo_quarantine_port_unsafe(popop, portp->poportp, type); + _popo_unlock(popop); +} + +static boolean +_clear_quarantine(char * name, QUICK_LIST * list) +{ + if (QListIsEmpty(list)) + return FALSE; + + IB_LOG_INFINI_INFO_FMT(__func__, "POPO: clearing quarantine: name[%s] count[%u]", + name, QListCount(list)); + + LIST_ITEM * li, * next; + for (li = QListHead(list); li; li = next) { + next = QListNext(list, li); + QListRemoveItem(list, li); + PopoPort_t * poportp = PARENT_STRUCT(li, PopoPort_t, quarantine.entry); + poportp->quarantine.type = POPO_QUARANTINE_NONE; + } + + return TRUE; +} + +// Returns TRUE if any ports were unquarantined. +boolean +sm_popo_clear_short_quarantine(Popo_t * popop) +{ + boolean unquarantined = FALSE; + _popo_lock(popop); + unquarantined |= _clear_quarantine("short", &popop->quarantine.shortTerm); + _popo_unlock(popop); + return unquarantined; +} + +uint64_t sm_popo_scale_timeout(Popo_t * popop, uint64_t timeout) +{ + uint64_t limit = sm_config.cumulative_timeout_limit; + if (limit == 0) return timeout; + + uint64_t total = AtomicRead(&popop->errors.cumulativeTimeout); + total = MIN(total, limit); + return (uint64_t)(timeout * (1.0 - (double)total / limit)); +} + +void sm_popo_report_timeout(Popo_t * popop, uint64_t timeout) +{ + AtomicAdd(&popop->errors.cumulativeTimeout, timeout); +} + +Status_t +sm_popo_port_error(Popo_t * popop, Topology_t * topop, Port_t * portp, Status_t status) +{ + if (!portp || status != VSTATUS_TIMEOUT || !sm_config.cumulative_timeout_limit) + return status; + + _popo_lock(popop); + + sm_popo_quarantine_port_unsafe(popop, portp->poportp, POPO_QUARANTINE_SHORT); + + Port_t * nportp = sm_find_port(topop, portp->nodeno, portp->portno); + if (sm_valid_port(nportp)) + sm_popo_quarantine_port_unsafe(popop, nportp->poportp, POPO_QUARANTINE_SHORT); + + Status_t retStatus = status; + if (AtomicRead(&popop->errors.cumulativeTimeout) >= sm_config.cumulative_timeout_limit) + retStatus = VSTATUS_TIMEOUT_LIMIT; + + _popo_unlock(popop); + + return retStatus; +} + +void +sm_popo_reset_errors(Popo_t * popop) +{ + AtomicWrite(&popop->errors.cumulativeTimeout, 0); +} + +boolean +sm_popo_should_abandon(Popo_t * popop) +{ + uint32_t limit = sm_config.cumulative_timeout_limit; + return limit && AtomicRead(&popop->errors.cumulativeTimeout) >= limit; +} + +void sm_popo_update_node(PopoNode_t * ponodep) +{ + ponodep->info.pass = topology_passcount; +} + +void sm_popo_end_sweep(Popo_t * popop) +{ + sm_popo_reset_errors(popop); + _popo_gc(popop, FALSE); +} + diff --git a/Esm/ib/src/smi/sm/sm_qos.c b/Esm/ib/src/smi/sm/sm_qos.c index 8fef69a0..e8586d85 100644 --- a/Esm/ib/src/smi/sm/sm_qos.c +++ b/Esm/ib/src/smi/sm/sm_qos.c @@ -572,7 +572,7 @@ PopulateSCtoSL(RoutingModule_t *rm, const Qos_t * qos, // map explicitly shows all SC to SL mappings. for (vl_i = 0; vl_i < numSCs; vl_i++) { bitset_clear(&freeVLs, vl + vl_i); - SCtoSL[sc + vl_i] = sl; + SCtoSL[sc + vl_i] = vfp->standby? 15 : sl; } SLtoSC[sl] = sc; } @@ -841,6 +841,7 @@ sm_initialize_Switch_SLSCMap(Topology_t * topop, Node_t * switchp, IB_LOG_WARN_FMT(__func__, "Failed to get Port 0 of Switch " FMT_U64, switchp->nodeInfo.NodeGUID); + IB_EXIT(__func__, VSTATUS_BAD); return VSTATUS_BAD; } @@ -857,6 +858,7 @@ sm_initialize_Switch_SLSCMap(Topology_t * topop, Node_t * switchp, IB_LOG_WARNRC("Failed to get SLSC " "map from routing algorithm; rc:", status); + IB_EXIT(__func__, status); return status; } @@ -873,6 +875,7 @@ sm_initialize_Switch_SLSCMap(Topology_t * topop, Node_t * switchp, "Failed to set SLSC Map for switch node %s nodeGuid " FMT_U64, sm_nodeDescString(switchp), switchp->nodeInfo.NodeGUID); switchp->slscChange = 1; + status = sm_popo_port_error(&sm_popo, sm_topop, swportp, status); } swportp->portData->current.slsc = (status == VSTATUS_OK); #else @@ -887,7 +890,7 @@ sm_initialize_Switch_SLSCMap(Topology_t * topop, Node_t * switchp, #endif - IB_EXIT(__func__, 0); + IB_EXIT(__func__, status); return (status); } @@ -907,7 +910,7 @@ sm_initialize_Switch_SCSLMap(Topology_t * topop, Node_t * switchp, IB_LOG_WARN_FMT(__func__, "Failed to get Port 0 of Switch " FMT_U64, switchp->nodeInfo.NodeGUID); - IB_EXIT(__func__, 1); + IB_EXIT(__func__, VSTATUS_BAD); return VSTATUS_BAD; } @@ -923,6 +926,7 @@ sm_initialize_Switch_SCSLMap(Topology_t * topop, Node_t * switchp, IB_LOG_WARNRC("Failed to get SCSL " "map from routing algorithm; rc:", status); + IB_EXIT(__func__, status); return status; } @@ -940,6 +944,7 @@ sm_initialize_Switch_SCSLMap(Topology_t * topop, Node_t * switchp, "Failed to set SCSL Map for switch node %s nodeGuid " FMT_U64, sm_nodeDescString(switchp), switchp->nodeInfo.NodeGUID); switchp->slscChange = 1; + status = sm_popo_port_error(&sm_popo, sm_topop, swportp, status); } swportp->portData->current.scsl = (status == VSTATUS_OK); #else @@ -952,7 +957,7 @@ sm_initialize_Switch_SCSLMap(Topology_t * topop, Node_t * switchp, swportp->portData->scslMap = *scslmapp; #endif - IB_EXIT(__func__, 0); + IB_EXIT(__func__, status); return (status); } @@ -1202,10 +1207,13 @@ sm_initialize_Switch_SCVLMaps(Topology_t * topop, Node_t * switchp) status = SM_Set_SCVLrMap_LR(fd_topology, amod, sm_lid, swportp->portData->lid, &scvlmap, sm_config.mkey); if (status != VSTATUS_OK) { - IB_LOG_WARN_FMT("sm_initialize_Switch_SCVLMaps", - "Failed to set SCVL_r Map for node %s nodeGuid " FMT_U64 - " output port %d", sm_nodeDescString(switchp), - switchp->nodeInfo.NodeGUID, swportp->index); + IB_LOG_WARN_FMT("sm_initialize_Switch_SCVLMaps", + "Failed to set SCVL_r Map for node %s nodeGuid " FMT_U64 + " output port %d", sm_nodeDescString(switchp), + switchp->nodeInfo.NodeGUID, swportp->index); + status = sm_popo_port_error(&sm_popo, sm_topop, swportp, status); + if (status == VSTATUS_TIMEOUT_LIMIT) + goto fail; } swportp->portData->current.scvlr = (status == VSTATUS_OK); swportp->portData->scvlrMap = scvlmap; @@ -1330,6 +1338,7 @@ sm_initialize_Switch_SCVLMaps(Topology_t * topop, Node_t * switchp) "Failed to set SCVL_t Map for node %s nodeGuid " FMT_U64 " output port %d", sm_nodeDescString(switchp), switchp->nodeInfo.NodeGUID, out_portp->index); + status = sm_popo_port_error(&sm_popo, sm_topop, swportp, status); goto fail; } if (out_portp->index > 0) @@ -1374,6 +1383,7 @@ sm_initialize_Switch_SCVLMaps(Topology_t * topop, Node_t * switchp) "Failed to set SCVL_nt Map for node %s nodeGuid " FMT_U64 " output port %d", sm_nodeDescString(neighborNodep), neighborNodep->nodeInfo.NodeGUID, neighborPortp->index); + status = sm_popo_port_error(&sm_popo, sm_topop, swportp, status); goto fail; } } else { @@ -1389,7 +1399,7 @@ sm_initialize_Switch_SCVLMaps(Topology_t * topop, Node_t * switchp) } fail: - IB_EXIT(__func__, 0); + IB_EXIT(__func__, status); return (status); } @@ -2026,6 +2036,7 @@ sm_syncSmaChanges(Topology_t * topop, Node_t ** firstError) s = sm_node_syncSmaChanges(topop, nodep, smaportp); if (s != VSTATUS_OK) { + s = sm_popo_port_error(&sm_popo, topop, smaportp, s); if (retStat == VSTATUS_OK) { if (firstError) *firstError = nodep; @@ -2035,12 +2046,15 @@ sm_syncSmaChanges(Topology_t * topop, Node_t ** firstError) IB_LOG_WARN_FMT(__func__, "Failed to sync changes for node %s, node GUID "FMT_U64", port %d", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, smaportp->index); - } + + if (s == VSTATUS_TIMEOUT_LIMIT) + return s; } + } - // dirty and change values are not currently copied sweep-to sweep, so free to - // release them whether or not Set() was successful - sm_node_release_changes(nodep); + // dirty and change values are not currently copied sweep-to sweep, so free to + // release them whether or not Set() was successful + sm_node_release_changes(nodep); } nodeIdx = bitset_find_next_one(topop->smaChanges, nodeIdx + 1); diff --git a/Esm/ib/src/smi/sm/sm_routing.c b/Esm/ib/src/smi/sm/sm_routing.c index 65710f15..ceb4471d 100644 --- a/Esm/ib/src/smi/sm/sm_routing.c +++ b/Esm/ib/src/smi/sm/sm_routing.c @@ -538,6 +538,9 @@ sm_calculate_all_lfts(Topology_t * topop) IB_LOG_ERROR_FMT(__func__, "Failed to allocate space for LFT."); return status; } + + // Initialize port group top prior to setting up groups. + switchp->switchInfo.PortGroupTop = 0; } for (i=0; i<2; i++) { diff --git a/Esm/ib/src/smi/sm/sm_routing_funcs.c b/Esm/ib/src/smi/sm/sm_routing_funcs.c index a5ced07f..745633be 100644 --- a/Esm/ib/src/smi/sm/sm_routing_funcs.c +++ b/Esm/ib/src/smi/sm/sm_routing_funcs.c @@ -1221,7 +1221,6 @@ sm_routing_func_setup_pgs(struct _Topology *topop, struct _Node * srcSw, struct int end_port = topop->routingModule->funcs.select_ports(topop, srcSw, dstSw->swIdx, ordered_ports, 0); if (end_port <= 1) { - srcSw->switchInfo.PortGroupTop = 0; return VSTATUS_OK; } @@ -1247,7 +1246,7 @@ sm_routing_func_setup_pgs(struct _Topology *topop, struct _Node * srcSw, struct if (rc >= 0) { srcSw->arChange |= (rc > 0); - srcSw->switchInfo.PortGroupTop = srcSw->pgtLen; //MAX(srcSw->switchInfo.PortGroupTop, srcSw->pgtLen); + srcSw->switchInfo.PortGroupTop = srcSw->pgtLen; //PGFT is independent of LFT with LMC, though it's supposed to re-use the LMC data PORT * pgft = sm_Node_get_pgft_wr(srcSw); diff --git a/Esm/ib/src/smi/sm/sm_topology.c b/Esm/ib/src/smi/sm/sm_topology.c index fa05cd51..18f15078 100644 --- a/Esm/ib/src/smi/sm/sm_topology.c +++ b/Esm/ib/src/smi/sm/sm_topology.c @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT7 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -154,6 +154,7 @@ Status_t topology_activate(void); Status_t topology_changes(Topology_t *old_topo, Topology_t *new_topo); Status_t topology_TrapUp(STL_NOTICE * noticep, Topology_t *, Topology_t *, Node_t *, Port_t *); Status_t topology_TrapDown(STL_NOTICE * noticep, Topology_t *, Topology_t *, Node_t *, Port_t *); +Status_t topology_TrapCostMatrixChange(STL_NOTICE *noticep); Status_t topology_copy(void); Status_t topology_release_saved_topology(void); Status_t topology_multicast(void); @@ -210,6 +211,7 @@ static const char *sweep_reasons[] = { [SM_SWEEP_REASON_INTERVAL_CHANGE] = "SM sweep interval changed by user.", [SM_SWEEP_REASON_FAILED_SWEEP] = "Problems during previous sweep, retrying.", [SM_SWEEP_REASON_TRAP_EVENT] = "Trap event occurred that requires re-sweep.", + [SM_SWEEP_REASON_UNQUARANTINE] = "Last sweep succeeded with quarantined devices: clearing short-term quarantine and retrying.", [SM_SWEEP_REASON_UNDETERMINED] = "No reason was specified (WARNING: abormal!)." }; @@ -230,6 +232,8 @@ Topology_t sm_newTopology; Topology_t save_topology; Topology_t *sm_topop = &sm_newTopology; +Popo_t sm_popo; + FabricData_t preDefTopology; bitset_t old_switchesInUse; @@ -725,6 +729,11 @@ topology_main(uint32_t argc, uint8_t ** argv) return; } +// +// Initialize persistent topology +// + sm_popo_init(&sm_popo); + // // Initialize our counters // @@ -849,16 +858,33 @@ topology_main(uint32_t argc, uint8_t ** argv) for (i = 0; topology_functions[i] != NULL; i++) { status = (topology_functions[i])(); + + // if the local port was marked down mid-sweep, we're not + // going to make progress. reset the short-term quarantine + // and force the status to UNRECOVERABLE + if (sm_topop->node_head) { + Port_t * sm_portp = sm_get_port(sm_topop->node_head, sm_config.port); + if (sm_portp && sm_portp->state == IB_PORT_DOWN) { + sm_popo_clear_short_quarantine(&sm_popo); + status = VSTATUS_UNRECOVERABLE; + } + } + if (status != VSTATUS_OK) { // UNRECOVERABLE errors indicate sweep-local unrecoverable problems. // future sweeps may succeed, but don't attempt progress on abandonment if (status != VSTATUS_UNRECOVERABLE && status != VSTATUS_NOT_MASTER) { // catch-all for any error condition that did not adjust the global topology // error counter or topology abandonment counter. - if (topo_errors == prev_topo_errors) - topo_errors++; - if (topo_abandon_count == prev_topo_abandon_count) - topo_abandon_count++; + // + // if the timeout limit is exceeded, don't cause a brute-force sweep, + // but allow one to progress if it's already triggered + if (status != VSTATUS_TIMEOUT_LIMIT) { + if (topo_errors == prev_topo_errors) + topo_errors++; + if (topo_abandon_count == prev_topo_abandon_count) + topo_abandon_count++; + } if (topo_errors > sm_config.topo_errors_threshold && topo_abandon_count > sm_config.topo_abandon_threshold) { // abandonment threshold exceeded, so ignore error conditions and @@ -955,6 +981,7 @@ topology_main(uint32_t argc, uint8_t ** argv) clearSaTables(); } } + (void)vs_unlock(&new_topology_lock); /* print DG and VF memberships per node */ @@ -965,6 +992,8 @@ topology_main(uint32_t argc, uint8_t ** argv) newTopologyValid = 0; } + if (sm_debug) sm_popo_report(&sm_popo); + (void)vs_time_get(&now); if (newTopologyValid) { int newSmCount = sm_dbsync_getSmCount(); @@ -1078,10 +1107,19 @@ topology_main(uint32_t argc, uint8_t ** argv) /* if topology change allow a rediscovery of CCA */ if (haveDelta) cca_discovery_count = 0; - } + + if (sm_popo_clear_short_quarantine(&sm_popo)) + sm_request_resweep(1, 1, SM_SWEEP_REASON_UNQUARANTINE); + } else { + IB_LOG_INFINI_INFO_FMT(__func__, + "DISCOVERY CYCLE FAIL. %d SWs, %d HFIs, %d end ports, %d total ports, %d packets, %d retries", + sm_topop->num_sws, (sm_topop->num_nodes-sm_topop->num_sws), sm_topop->num_endports, sm_topop->num_ports, + ((unsigned int)sm_smInfo.ActCount - sweepStartPacketCount), + (int)AtomicRead(&smCounters[smCounterPacketRetransmits].sinceLastSweep)); + } } else { - /* clear the SA tables if necessary */ - clearSaTables(); + /* clear the SA tables if necessary */ + clearSaTables(); topology_passcount=0; } @@ -1108,8 +1146,7 @@ topology_main(uint32_t argc, uint8_t ** argv) (void)topology_congestion(); } - - + sm_popo_end_sweep(&sm_popo); } // End of while(1) /* clear the isSM bit from our port */ @@ -1149,6 +1186,8 @@ topology_uninitialize(void) sm_dispatch_destroy(&sm_asyncDispatch); sm_removedEntities_destroy(); + + sm_popo_destroy(&sm_popo); } #endif @@ -1222,27 +1261,27 @@ static int verify_admin_membership(Port_t *portp) { int vfi, dg; - VFConfig_t *vfp; + VFConfig_t *vfp = NULL; int okay = 0; (void)vs_rdlock(&old_topology_lock); if (old_topology.vfs_ptr) { // Find the Admin VF. - for (vfi=0; - vfi < old_topology.vfs_ptr->number_of_vfs && - ((old_topology.vfs_ptr->v_fabric[vfi].pkey & ~0x8000) != STL_DEFAULT_PKEY); - vfi++) { - // Empty body. Work is done in the conditional. + for (vfi=0; vfi < old_topology.vfs_ptr->number_of_vfs; vfi++) { + if((old_topology.vfs_ptr->v_fabric[vfi].pkey & ~0x8000) == STL_DEFAULT_PKEY) { + vfi = old_topology.vfs_ptr->v_fabric[vfi].index; + vfp = vf_config.vf[vfi]; + break; + } } - if (vfi >= old_topology.vfs_ptr->number_of_vfs) { + if (vfp == NULL) { (void)vs_rwunlock(&old_topology_lock); IB_LOG_ERROR_FMT(__func__,"Could not identify the Admin VF."); goto done; } - vfp = vf_config.vf[vfi]; IB_LOG_INFO_FMT(__func__,"\"%s\" is the admin VF.", vfp->name); for (dg=0; dg < vfp->number_of_full_members; dg++) { @@ -1446,10 +1485,15 @@ topology_initialize(void) if (status != VSTATUS_OK) IB_FATAL_ERROR_NODUMP("Failed to allocate quarantined node map"); + status = vs_pool_alloc(&sm_pool, sizeof(cl_qmap_t), (void *)&sm_newTopology.switchLids); + if (status != VSTATUS_OK) + IB_FATAL_ERROR_NODUMP("Failed to allocate switch lid map"); + cl_qmap_init(sm_newTopology.nodeIdMap, NULL); cl_qmap_init(sm_newTopology.nodeMap, NULL); cl_qmap_init(sm_newTopology.portMap, NULL); cl_qmap_init(sm_newTopology.quarantinedNodeMap, NULL); + cl_qmap_init(sm_newTopology.switchLids, NULL); sm_newTopology.smaChanges = NULL; sm_newTopology.nodeArray = NULL; @@ -1739,6 +1783,11 @@ topology_discovery(void) return status; } #endif + + if (status == VSTATUS_TIMEOUT_LIMIT) { + IB_LOG_ERROR_FMT(__func__, "Cumulative timeout limit exceeded: abandoning discovery"); + return status; + } } else { // discovery went well @@ -2200,6 +2249,18 @@ topology_resolve(void) if (max_lid > sm_newTopology.maxLid) { sm_newTopology.maxLid = max_lid; } + + if (nodep->nodeInfo.NodeType == NI_TYPE_SWITCH){ + //insert into switch list + if (cl_qmap_insert(sm_newTopology.switchLids, (uint64_t)portp->portData->lid, &nodep->switchLidMapObj.item) + != &nodep->switchLidMapObj.item) { + IB_LOG_WARN_FMT(__func__, "Error adding switch LID 0x%x to tree. Already in tree!", + portp->portData->lid); + } + else { + cl_qmap_set_obj(&nodep->switchLidMapObj, nodep); + } + } } } } @@ -2420,10 +2481,9 @@ static Status_t buffer_control_assignments(void) if ((status=sm_set_buffer_control_tables(fd_topology, nodep, portp->index, portp->index, &tmp_bcts[portp->index])) != VSTATUS_OK) { - if (++topo_errors > sm_config.topo_errors_threshold && - ++topo_abandon_count <= sm_config.topo_abandon_threshold) { + status = sm_popo_port_error(&sm_popo, sm_topop, portp, status); + if (status == VSTATUS_TIMEOUT_LIMIT) goto exit; - } } needSet = 0; portp->portData->current.bfrctrl = 1; @@ -2515,6 +2575,7 @@ topology_assignments(void) IB_LOG_ERROR_FMT(__func__, "Failed to get Switchinfo for node %s guid "FMT_U64": status = %d", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, status); + status = sm_popo_port_error(&sm_popo, sm_topop, portp, status); IB_EXIT(__func__, status); return(status); } @@ -2540,7 +2601,7 @@ topology_assignments(void) } { - Lid_t maxMCLid; + STL_LID maxMCLid; if (nodep->switchInfo.MulticastFDBTop != (maxMCLid = sm_multicast_get_max_lid())) { nodep->switchInfo.MulticastFDBTop = maxMCLid; doSet = 1; @@ -2596,7 +2657,6 @@ topology_assignments(void) // data of the switch nodep->switchInfo.AdaptiveRouting.s.Pause = pauseState ? 1 : 0; status = SM_Set_SwitchInfo(fd_topology, 0, nodep->path, &nodep->switchInfo, portp->portData->portInfo.M_Key); - if (status == VSTATUS_OK) { nodep->switchInfo.AdaptiveRouting.s.Pause = pauseState ? 1 : 0; if (sm_adaptiveRouting.debug) { @@ -2604,7 +2664,10 @@ topology_assignments(void) "Setting adaptive routing pause (%d) for switch %s guid "FMT_U64, pauseState, sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID); } - + } else { + status = sm_popo_port_error(&sm_popo, sm_topop, portp, status); + if (status == VSTATUS_TIMEOUT_LIMIT) + return status; } } } @@ -2650,41 +2713,45 @@ topology_assignments(void) if ((nodep->nodeInfo.NodeType == NI_TYPE_SWITCH && portp->index == 0) || (nodep == sm_topop->node_head && portp->index == sm_config.port)) continue; /* Port 0 of switches and SM port are already initialized above*/ + status = sm_initialize_port_LR_DR(sm_topop, nodep, portp); if (status != VSTATUS_OK) { - /* see if we are unable to initialize the local port */ - if (nodep == sm_topop->node_head && portp->index == sm_config.port) { + /* see if we are unable to initialize the local port */ + if (nodep == sm_topop->node_head && portp->index == sm_config.port) return topology_sm_port_init_failure(); - } else { - /* when not local port */ - sm_port_retry_count = 0; /*reset the counter used for retry backoff*/ - if (topology_main_exit == 1) { + + /* when not local port */ + sm_port_retry_count = 0; /*reset the counter used for retry backoff*/ + if (topology_main_exit == 1) { #ifdef __VXWORKS__ - ESM_LOG_ESMINFO("topology_assignments: SM has been stopped", 0); + ESM_LOG_ESMINFO("topology_assignments: SM has been stopped", 0); #endif - IB_EXIT(__func__, VSTATUS_OK); - return(VSTATUS_OK); - } - if (++topo_errors > sm_config.topo_errors_threshold && - ++topo_abandon_count <= sm_config.topo_abandon_threshold) { - return(status); - } - } - sm_mark_link_down(sm_topop, portp); - topology_changed = 1; /* indicates a fabric change has been detected */ + IB_EXIT(__func__, VSTATUS_OK); + return(VSTATUS_OK); + } + + sm_mark_link_down(sm_topop, portp); + topology_changed = 1; /* indicates a fabric change has been detected */ IB_LOG_ERROR_FMT(__func__, - "Marking port[%d] of node[%d] %s guid "FMT_U64" DOWN in the topology", - portp->index, nodep->index, sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID); + "Marking port[%d] of node[%d] %s guid "FMT_U64" DOWN in the topology", + portp->index, nodep->index, sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID); + + status = sm_popo_port_error(&sm_popo, sm_topop, portp, status); + if (status == VSTATUS_TIMEOUT_LIMIT) + return status; + status = VSTATUS_OK; - } else if (nodep->nodeInfo.NodeType == NI_TYPE_SWITCH && - (portp->index != 0 || nodep->switchInfo.u2.s.EnhancedPort0)) { + } else if (nodep->nodeInfo.NodeType == NI_TYPE_SWITCH && + (portp->index != 0 || nodep->switchInfo.u2.s.EnhancedPort0)) { + if (vlInUse == 0xff) { vlInUse = portp->portData->vl1; } else if (vlInUse != portp->portData->vl1) { nodep->uniformVL = 0; } + nodep->vlCap = MAX(nodep->vlCap, portp->portData->vl0); } } @@ -2713,14 +2780,26 @@ topology_assignments(void) status = sm_node_updateFields(fd_topology, sm_lid, nodep, smaportp); if (status != VSTATUS_OK) { - Port_t *neigh = sm_find_port(sm_topop, smaportp->nodeno, smaportp->portno); + if (smaportp->index) { + Port_t *neigh = sm_find_port(sm_topop, smaportp->nodeno, smaportp->portno); + IB_LOG_WARN_FMT(__func__, + "Non-OK status returned on updating node attached to %s port %d via SMA:" + " Node %s, nodeGuid "FMT_U64", port %d, status %d", + sm_valid_port(neigh) ? sm_nodeDescString(neigh->portData->nodePtr) : "???", + neigh ? neigh->index : -1, sm_nodeDescString(nodep), + nodep->nodeInfo.NodeGUID, smaportp->index, status); + } + else { // switch port 0; no neighbor + IB_LOG_WARN_FMT(__func__, + "Non-OK status returned on updating node via SMA:" + " Node %s, nodeGuid "FMT_U64", port %d, status %d", + sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, smaportp->index, status); + } + + status = sm_popo_port_error(&sm_popo, sm_topop, smaportp, status); + if (status == VSTATUS_TIMEOUT_LIMIT) + return status; - IB_LOG_WARN_FMT(__func__, - "Non-OK status returned on updating node attached to %s port %d via SMA:" - " Node %s, nodeGuid "FMT_U64", port %d, status %d", - sm_valid_port(neigh) ? sm_nodeDescString(neigh->portData->nodePtr) : "???", - neigh ? neigh->index : -1, sm_nodeDescString(nodep), - nodep->nodeInfo.NodeGUID, smaportp->index, status); continue; } } @@ -2739,11 +2818,9 @@ topology_assignments(void) IB_EXIT(__func__, VSTATUS_OK); return(VSTATUS_OK); } - if (++topo_errors > sm_config.topo_errors_threshold && - ++topo_abandon_count <= sm_config.topo_abandon_threshold) { - return(status); - } - // sm_request_resweep(0, 0, "Error programming fabric SC tables") + + if (status == VSTATUS_TIMEOUT_LIMIT) + return status; } // Setup vlarb for each port on switch @@ -2761,11 +2838,6 @@ topology_assignments(void) return(VSTATUS_OK); } - if (++topo_errors > sm_config.topo_errors_threshold && - ++topo_abandon_count <= sm_config.topo_abandon_threshold) { - return(status); - } - sm_mark_link_down(sm_topop, portp); topology_changed = 1; /* indicates a fabric change has been detected */ IB_LOG_ERROR_FMT(__func__, @@ -2773,6 +2845,10 @@ topology_assignments(void) FMT_U64 " node index %d port index %d", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, nodep->index, portp->index); + + status = sm_popo_port_error(&sm_popo, sm_topop, portp, status); + if (status == VSTATUS_TIMEOUT_LIMIT) + return status; } } @@ -2818,6 +2894,7 @@ topology_assignments(void) IB_LOG_ERROR_FMT(__func__, "Failed to set PortInfo for node %s nodeGuid "FMT_U64", port %d: status = %d", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, curPort->index, status); + status = sm_popo_port_error(&sm_popo, sm_topop, switchP0, status); IB_EXIT(__func__, status); return status; } @@ -2843,15 +2920,17 @@ topology_assignments(void) IB_EXIT(__func__, VSTATUS_OK); return(VSTATUS_OK); } - if (++topo_errors > sm_config.topo_errors_threshold && - ++topo_abandon_count <= sm_config.topo_abandon_threshold) { - return(status); - } + sm_mark_link_down(sm_topop, portp); topology_changed = 1; /* indicates a fabric change has been detected */ IB_LOG_ERROR_FMT(__func__, "Failed to init SL2SC/SC2SL Map (setting port down) on node %s nodeGuid "FMT_U64" node index %d port index %d", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, nodep->index, portp->index); + + status = sm_popo_port_error(&sm_popo, sm_topop, portp, status); + if (status == VSTATUS_TIMEOUT_LIMIT) + return status; + continue; } @@ -2864,15 +2943,15 @@ topology_assignments(void) return(VSTATUS_OK); } - if (++topo_errors > sm_config.topo_errors_threshold && - ++topo_abandon_count <= sm_config.topo_abandon_threshold) { - return(status); - } sm_mark_link_down(sm_topop, portp); topology_changed = 1; /* indicates a fabric change has been detected */ IB_LOG_ERROR_FMT(__func__, "Failed to init VL Arb (setting port down) on node %s nodeGuid "FMT_U64" node index %d port index %d", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, nodep->index, portp->index); + + status = sm_popo_port_error(&sm_popo, sm_topop, portp, status); + if (status == VSTATUS_TIMEOUT_LIMIT) + return status; } } } @@ -3077,12 +3156,12 @@ topology_adaptiverouting(void) IB_EXIT(__func__, VSTATUS_OK); return(VSTATUS_OK); } - continue; - if (++topo_errors > sm_config.topo_errors_threshold && - ++topo_abandon_count <= sm_config.topo_abandon_threshold) { - return(status); - } + status = sm_popo_port_error(&sm_popo, sm_topop, sm_get_port(nodep, 0), status); + if (status == VSTATUS_TIMEOUT_LIMIT) + return status; + + continue; } } } @@ -3135,6 +3214,8 @@ topology_update_cableinfo(void) { IB_LOG_ERROR_FMT(__func__, "Failed to Get(CableInfo) for node %s nodeGuid "FMT_U64" port %d", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, portp->index); + if (status == VSTATUS_TIMEOUT_LIMIT) + return status; } } } @@ -3148,6 +3229,7 @@ topology_update_cableinfo(void) { Status_t topology_activate(void) { + Status_t status = VSTATUS_OK; Port_t *portp; Node_t *nodep; uint64_t sTime, iTime, eTime; @@ -3174,15 +3256,21 @@ topology_activate(void) // Transition ports from INIT to ARMED per DN0567 for_all_ca_nodes(sm_topop, nodep) - sm_arm_node(sm_topop, nodep); + if ((status = sm_arm_node(sm_topop, nodep)) == VSTATUS_TIMEOUT_LIMIT) + goto post_arm; for_all_switch_nodes(sm_topop, nodep) - sm_arm_node(sm_topop, nodep); + if ((status = sm_arm_node(sm_topop, nodep)) == VSTATUS_TIMEOUT_LIMIT) + goto post_arm; +post_arm: if (smDebugPerf) { vs_time_get(&iTime); IB_LOG_INFINI_INFO_FMT(__func__, "END ARM ports; elapsed time(usecs)=%"PRIu64, iTime - sTime); } + if (status == VSTATUS_TIMEOUT_LIMIT) + return status; + // sending of armed idle flits can be delayed by several millis, preventing // activation due to NeighborNormal not being set. simply wait out the // expected propagation time to avoid spamming the log with failures due @@ -3206,19 +3294,22 @@ topology_activate(void) case SCAE_DISABLED: // failsafe activation: activate ports serially via Set(PortInfo) // only. activate HFIs first to allow traffic flow a bit sooner - sm_activate_all_hfi_first_safe(sm_topop, &retry); + if ((status = sm_activate_all_hfi_first_safe(sm_topop, &retry)) == VSTATUS_TIMEOUT_LIMIT) + goto post_activate; break; case SCAE_SW_ONLY: // only switches will cascade, as HFI activation should be paced. // activate HFIs first to allow traffic flow a bit sooner and // switches will implicitly cascade as a result - sm_activate_all_hfi_first(sm_topop, &retry); + if ((status = sm_activate_all_hfi_first(sm_topop, &retry)) == VSTATUS_TIMEOUT_LIMIT) + goto post_activate; break; case SCAE_ALL: // all ports will cascade: do switches first for faster overall // cascade at scale, relying on activating switches to implicitly // activate hfis - sm_activate_all_switch_first(sm_topop, &retry); + if ((status = sm_activate_all_switch_first(sm_topop, &retry)) == VSTATUS_TIMEOUT_LIMIT) + goto post_activate; break; } @@ -3234,9 +3325,16 @@ topology_activate(void) IB_LOG_ERROR_FMT(__func__, "%d ports failed to go active due to NeighborNormal never being set", retry.failures); } +post_activate: if (smDebugPerf) { vs_time_get(&eTime); IB_LOG_INFINI_INFO_FMT(__func__, "END ACTIVATE ports; elapsed time(usecs)=%"PRIu64, eTime - iTime); + } + + if (status == VSTATUS_TIMEOUT_LIMIT) + return status; + + if (smDebugPerf) { IB_LOG_INFINI_INFO_FMT(__func__, "START CABLEINFO"); iTime = eTime; } @@ -3575,6 +3673,12 @@ topology_changes(Topology_t *old_topo, Topology_t *new_topo) } /* end for_all_nodes(new_topo, newNodep) */ } + + /* Generate Trap if Cost Matrix has Changed */ + if (topology_cost_path_changes && routing_recalculated) { + status = topology_TrapCostMatrixChange(¬ice); + } + IB_EXIT(__func__, status); return status; } @@ -3881,6 +3985,21 @@ topology_TrapDown(STL_NOTICE * noticep, Topology_t * tp_present, Topology_t * tp return(VSTATUS_OK); } +Status_t +topology_TrapCostMatrixChange(STL_NOTICE *noticep) +{ + Status_t status = VSTATUS_OK; + STL_NOTICE * trap2049 = (STL_NOTICE *)noticep; + + trap2049->Attributes.Generic.TrapNumber = STL_TRAP_COST_MATRIX_CHANGE; + /* queue up trap forwarding request to sm_async */ + if ((status = sm_sa_forward_trap(noticep)) != VSTATUS_OK){ + IB_LOG_ERRORRC("unable to queue trap to sm_async rc:", status); + } + + IB_EXIT(__func__, status); + return status; +} Status_t topology_copy(void) { @@ -4031,6 +4150,12 @@ topology_free_topology(Topology_t * topop) topop->quarantinedNodeMap = NULL; } + if(topop->switchLids){ + cl_qmap_remove_all(topop->switchLids); + (void)vs_pool_free(&sm_pool, (void *)topop->switchLids); + topop->switchLids = NULL; + } + while ((qnodep = topop->quarantined_node_head) != NULL) { topop->quarantined_node_head = qnodep->next; Node_Quarantined_Delete(qnodep); diff --git a/Esm/ib/src/smi/sm/sm_utility.c b/Esm/ib/src/smi/sm/sm_utility.c index 173bb90b..ab7b859d 100755 --- a/Esm/ib/src/smi/sm/sm_utility.c +++ b/Esm/ib/src/smi/sm/sm_utility.c @@ -76,7 +76,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifdef IB_STACK_OPENIB #include "mal_g.h" #endif -#include "iba/stl_sm.h" +#include "iba/stl_sm_priv.h" #include "time.h" #ifdef __VXWORKS__ #include "UiUtil.h" @@ -189,39 +189,55 @@ sm_getMadStatusText(uint16_t status) } // -// logHelper +// Renders a path into a string for logging. // -#define NODE_STRING_MAX_LEN 500// -char * smGetNodeString(uint8_t *path, uint16_t lid, Node_t *node, Port_t *port, - char *buff, uint32_t buffLen) +// Takes an explicit path length to support rendering paths straight out of +// packet buffers. +// +#define PATH_STRING_MAX_LEN (IBA_MAX_PATHSIZE * 4 + 7) // "Path[...]\0" +void smGetPathString(uint8_t *path, size_t pathlen, char *buf, size_t buflen) +{ + int i, end; + + memset(buf, 0, buflen); + + cs_snprintfcat(&buf, &buflen, "Path["); + + for (i = 1, end = MIN(pathlen, IBA_MAX_PATHSIZE); i <= end; ++i) { + if (i > 1) cs_snprintfcat(&buf, &buflen, " "); + cs_snprintfcat(&buf, &buflen, "%d", path[i]); + } + + cs_snprintfcat(&buf, &buflen, "]"); +} + +// +// Renders a node into an informational string for logging. +// +#define NODE_STRING_MAX_LEN 500 +static void +smGetNodeString(uint8_t *path, STL_LID lid, Node_t *node, Port_t *port, + char *buff, size_t buffLen) { int i; int pIndex = -1; - char *buffptr = buff; - memset(buffptr, 0, buffLen); + memset(buff, 0, buffLen); - //If we have a path supplied, lets add it to buffer - if(path != NULL){ - snprintf(buffptr, buffLen, "Path:["); - buffLen -= strlen(buffptr); - buffptr += strlen(buffptr); + // If we have a path supplied, lets add it to buffer + if (path != NULL){ + cs_snprintfcat(&buff, &buffLen, "Path:["); if(path[0] == 0) { - snprintf(buffptr, buffLen, "Local Port"); - buffLen -= strlen(buffptr); - buffptr += strlen(buffptr); + cs_snprintfcat(&buff, &buffLen, "Local Port"); if (!node && sm_topop) node = sm_topop->node_head; - } - else { + } else { for (i = 1; i <= (int) path[0]; i++) { - snprintf(buffptr, buffLen, "%2d ", path[i]); - buffLen -= strlen(buffptr); - buffptr += strlen(buffptr); + cs_snprintfcat(&buff, &buffLen, "%2d ", path[i]); } if (!node && sm_topop) { - if (lid == 0 || lid == PERMISSIVE_LID) { + if (lid == RESERVED_LID || lid == PERMISSIVE_LID) { // pure DR: resolve path normally node = sm_find_node_by_path(sm_topop, NULL, path); } else { @@ -232,51 +248,39 @@ char * smGetNodeString(uint8_t *path, uint16_t lid, Node_t *node, Port_t *port, } } } - snprintf(buffptr, buffLen, "]"); - buffLen -= strlen(buffptr); - buffptr += strlen(buffptr); + cs_snprintfcat(&buff, &buffLen, "]"); } // If we have a port - then the port index is valid - if (port) + if (port) pIndex = port->index; - //If we don't have a node but we do have a lid, lets try to look it up in - //topo - if(lid){ - snprintf(buffptr, buffLen, " Lid:[%d]", lid); - buffLen -= strlen(buffptr); - buffptr += strlen(buffptr); + // If we don't have a node but we do have a lid, lets try to look it up in + // topo + if (lid){ + cs_snprintfcat(&buff, &buffLen, " Lid:[%d]", lid); if(!node && (lid <= UNICAST_LID_MAX) && sm_topop) port = sm_find_node_and_port_lid(sm_topop, lid, &node); // If we just found the node by its LID, and its not a switch - // then the pindex is valid. + // then the pIndex is valid. if (port && node && (node->nodeInfo.NodeType != NI_TYPE_SWITCH)) { pIndex = port->index; } } - //Print node info if we have it - if(node){ + // Print node info if we have it + if (node) { if (pIndex!=-1) { - snprintf(buffptr, buffLen, " NodeGUID:[" FMT_U64 "] NodeDesc:[%s] PortIndex:[%d]", - node->nodeInfo.NodeGUID, node->nodeDesc.NodeString, pIndex); - buffLen -= strlen(buffptr); - buffptr += strlen(buffptr); + cs_snprintfcat(&buff, &buffLen, " NodeGUID:[" FMT_U64 "] NodeDesc:[%s] PortIndex:[%d]", + node->nodeInfo.NodeGUID, node->nodeDesc.NodeString, pIndex); } else { - snprintf(buffptr, buffLen, " NodeGUID:[" FMT_U64 "] NodeDesc:[%s] PortIndex:[unknown]", - node->nodeInfo.NodeGUID, node->nodeDesc.NodeString); - buffLen -= strlen(buffptr); - buffptr += strlen(buffptr); + cs_snprintfcat(&buff, &buffLen, " NodeGUID:[" FMT_U64 "] NodeDesc:[%s] PortIndex:[unknown]", + node->nodeInfo.NodeGUID, node->nodeDesc.NodeString); } + } else { + cs_snprintfcat(&buff, &buffLen, " [Can't find node in topology!]"); } - else { - snprintf(buffptr, buffLen, " [Can't find node in topology!]"); - buffLen -= strlen(buffptr); - buffptr += strlen(buffptr); - } - return buff; } void @@ -411,7 +415,11 @@ sm_send_request_impl(IBhandle_t fd, uint32_t method, uint32_t aid, // timeout = sm_config.rcv_wait_msec * 1000; // time to wait for reply - convert from // msecs to usecs - total_timeout = timeout * sm_config.max_retries; + total_timeout = sm_popo_scale_timeout(&sm_popo, timeout * sm_config.max_retries); + if (total_timeout == 0) { + status = VSTATUS_TIMEOUT; + goto skip_send; + } (void) vs_time_get(×ent); @@ -481,11 +489,15 @@ sm_send_request_impl(IBhandle_t fd, uint32_t method, uint32_t aid, i++; } while (cumulative_timeout < total_timeout); + (void) vs_time_get(&timercvd); + +skip_send: if (status == VSTATUS_TIMEOUT) { if (smDebugPerf) smLogHelper(VS_LOG_INFINI_INFO, __func__, "Timed out/Retries exhausted", aid, tid, "status", status); INCREMENT_COUNTER(smCounterSmTxRetriesExhausted); + sm_popo_report_timeout(&sm_popo, MAX(0, timercvd - timesent)); } else { /* With stepped retries, there could be excessive log messages, so display them when not using stepped retries */ @@ -577,9 +589,6 @@ sm_validate_incoming_mad(Mai_t * out_mad, Mai_t * in_mad) { Status_t status = VSTATUS_OK; char nodeString[NODE_STRING_MAX_LEN]; - Node_t *node = NULL; - Port_t *port = NULL; - uint8_t *path = NULL; if (sm_config.sma_spoofing_check) { // If the mad was an error (oh no!), actually time it out @@ -592,64 +601,66 @@ sm_validate_incoming_mad(Mai_t * out_mad, Mai_t * in_mad) // Directed Route Return Path Validation if (out_mad->base.mclass == MAD_CV_SUBN_DR) { - DRStlSmp_t *out_dr = ((DRStlSmp_t *) (out_mad->data)); - DRStlSmp_t *in_dr = ((DRStlSmp_t *) (in_mad->data)); - path = out_dr->InitPath; - if (memcmp(out_dr->InitPath, in_dr->InitPath, sizeof(out_dr->InitPath)) != 0) { - uint8_t i; - char nodeString[NODE_STRING_MAX_LEN]; - char guidString[19] = { 0 }; - const char errorStr[] = "Couldn't trace path to offending node - path was unrealizable"; - - - /* Edge case exist where neighbor node may be failing InitPath validation before - * we've had time to even setup our topology structure. So make sure we at least - * have our SM node in the database, otherwise don't bother tracing. - * - * Also note that we're only tracing to the offending node's neighboring port - not the - * node itself. This is due to the fact that the general use case will likely not have the - * offending node in the internal topology DB yet. - */ - if (sm_topop->node_head) { - port = sm_get_port(sm_topop->node_head, sm_config.port); - - for (i = 2; sm_valid_port(port) && i < (in_mad->base.hopCount + 1); i++) { - Port_t *lastPort = port; - - port = sm_find_port(sm_topop, port->nodeno, in_dr->InitPath[i]); - if (!sm_valid_port(port) || port->portData->nodePtr->nodeInfo.NodeType != STL_NODE_SW) { - port = lastPort; - --i; // Keep index of last valid port. - break; - } - } + DRStlSmp_t *out_dr = (DRStlSmp_t *)out_mad->data; + DRStlSmp_t *in_dr = (DRStlSmp_t *)in_mad->data; + + uint8_t outHops = MIN(out_mad->base.hopCount, IBA_MAX_PATHSIZE); + uint8_t inHops = MIN(in_mad->base.hopCount, IBA_MAX_PATHSIZE); + + if (sm_topop->node_head && outHops > 0 && + (outHops != inHops || memcmp(out_dr->InitPath, in_dr->InitPath, sizeof(out_dr->InitPath)) != 0)) + { + const char errorStr[] = ""; + STL_LID drlid = out_dr->DrSLID; + uint8_t outHops = MIN(out_mad->base.hopCount, IBA_MAX_PATHSIZE); + uint8_t inHops = MIN(in_mad->base.hopCount, IBA_MAX_PATHSIZE); + char outPathString[PATH_STRING_MAX_LEN]; + char inPathString[PATH_STRING_MAX_LEN]; + Node_t *node = NULL; + Port_t *port = NULL; + + // for logging, try to resolve the node neighboring the + // destination using only the outbound (trusted) path. keep in + // mind the path can be pure DR or mixed LR-DR + // + // FIXME: this topology access needs to go away or be + // implemented properly, as it is currently a data race. + // for now, it is a requirement to lookup and render node info + + // resolve the LR portion of the path + node = sm_topop->node_head; + if (drlid != RESERVED_LID && drlid != PERMISSIVE_LID) { + sm_find_node_and_port_lid(sm_topop, drlid, &node); + } - if (sm_valid_port(port)) { - uint8_t tempPath[in_mad->base.hopCount]; - - // smGetNodeString expects path[0] = hopCnt. Becuase this is the actual MAD contents, - // we need to make a modified copy of the path so we don't harm the underlying MAD. - // - // Keep in mind we only want the path up to the neigboring port, or the farthest port we could - // validate in the path - not the path to the node itself. - tempPath[0] = i - 2; - memcpy(&tempPath[1], &in_dr->InitPath[1], i - 2); - node = sm_find_port_node(sm_topop, port); - smGetNodeString(tempPath, - sm_valid_port(port) ? port->portData->lid : 0, - node, port, nodeString, NODE_STRING_MAX_LEN); - snprintf(guidString, 19, FMT_U64, port->portData->portInfo.NeighborNodeGUID); - } else - node = NULL; + if (outHops > 1) { + // from the LID-routed node, resolve the DR portion to the + // neighbor of the destination node (trim path by 1) + uint8_t path[outHops]; + path[0] = outHops - 1; + memcpy(path + 1, out_dr->InitPath + 1, outHops - 1); + node = sm_find_node_by_path(sm_topop, node, path); } + + if (node) { + port = sm_find_node_port(sm_topop, node, out_dr->InitPath[outHops]); + + smGetNodeString(NULL, + sm_valid_port(port) ? port->portData->portInfo.LID : 0, + node, port, nodeString, NODE_STRING_MAX_LEN); + } + + // render the raw paths + smGetPathString(out_dr->InitPath, outHops, outPathString, PATH_STRING_MAX_LEN); + smGetPathString(in_dr->InitPath, inHops, inPathString, PATH_STRING_MAX_LEN); IB_LOG_WARN_FMT(__func__, - "Dropping packet, InitPaths do not match for TID [" FMT_U64 - "] on request with AID[0x%x] '%s'. Offending node's neighbor port: %s. " - "Offending Node has NodeGUID [%s]", - out_mad->base.tid, out_mad->base.aid, sm_getAttributeIdText(out_mad->base.aid), - node ? nodeString : errorStr, - sm_valid_port(port) ? guidString : "N/A"); + "Dropping packet, InitPaths do not match for TID[" FMT_U64 + "] on request with AID[0x%x] '%s'. DestNodeGuid[" FMT_U64 + "] Neighbor[%s] OutboundPath[%s] InboundPath[%s]", + out_mad->base.tid, out_mad->base.aid, sm_getAttributeIdText(out_mad->base.aid), + sm_valid_port(port) ? port->portData->portInfo.NeighborNodeGUID : 0, + node ? nodeString : errorStr, outPathString, inPathString); status = VSTATUS_TIMEOUT; } @@ -680,7 +691,17 @@ sm_validate_incoming_mad(Mai_t * out_mad, Mai_t * in_mad) || (in_mad->addrInfo.pkey != STL_DEFAULT_FM_PKEY && in_mad->addrInfo.pkey != STL_DEFAULT_CLIENT_PKEY)) { #endif - smGetNodeString(path, in_mad->addrInfo.slid, node, port, nodeString, NODE_STRING_MAX_LEN); + if (out_mad->base.mclass == MAD_CV_SUBN_DR) { + DRStlSmp_t *in_dr = (DRStlSmp_t *)in_mad->data; + uint8_t hops = MIN(in_mad->base.hopCount, IBA_MAX_PATHSIZE); + uint8_t path[hops + 1]; + path[0] = hops; + memcpy(path + 1, in_dr->InitPath + 1, hops); + smGetNodeString(path, in_dr->DrSLID, NULL, NULL, nodeString, NODE_STRING_MAX_LEN); + } else { + smGetNodeString(NULL, in_mad->addrInfo.slid, NULL, NULL, nodeString, NODE_STRING_MAX_LEN); + } + IB_LOG_WARN_FMT(__func__, "Dropping packet, invalid P_Key 0x%x from %s with TID [" FMT_U64 "] on request with MClass: 0x%02x, Method: 0x%02x, AttrID: 0x%04x", @@ -847,7 +868,11 @@ sm_send_stl_request_impl(IBhandle_t fd, uint32_t method, uint32_t aid, // timeout = sm_config.rcv_wait_msec * 1000; // time to wait for reply - convert from // msecs to usecs - total_timeout = timeout * sm_config.max_retries; + total_timeout = sm_popo_scale_timeout(&sm_popo, timeout * sm_config.max_retries); + if (total_timeout == 0) { + status = VSTATUS_TIMEOUT; + goto skip_send; + } (void) vs_time_get(×ent); @@ -930,6 +955,9 @@ sm_send_stl_request_impl(IBhandle_t fd, uint32_t method, uint32_t aid, } while (cumulative_timeout < total_timeout); + (void) vs_time_get(&timercvd); + +skip_send: if (status == VSTATUS_TIMEOUT) { if (smDebugPerf) { smGetNodeString(path, dlid, node, port, nodeString, NODE_STRING_MAX_LEN); @@ -938,11 +966,11 @@ sm_send_stl_request_impl(IBhandle_t fd, uint32_t method, uint32_t aid, sm_getMadStatusText(out_mad.base.status), out_mad.base.status); } INCREMENT_COUNTER(smCounterSmTxRetriesExhausted); + sm_popo_report_timeout(&sm_popo, MAX(0, timercvd - timesent)); } else { /* With stepped retries, there could be excessive log messages, so display them when not using stepped retries */ if (smDebugPerf && (sendSuccess==TRUE) && (sm_config.min_rcv_wait_msec == 0)) { - (void) vs_time_get(&timercvd); i = (int) (timercvd - timesent); if (i > 10000) { if (path != NULL) { @@ -1048,6 +1076,13 @@ sm_send_stl_request_impl(IBhandle_t fd, uint32_t method, uint32_t aid, // for async, caller already has lock // sending request asynchronous of reply receipt // get a context for this report mad + + total_timeout = sm_popo_scale_timeout(&sm_popo, sm_async_send_rcv_cntxt.totalTimeout); + if (total_timeout == 0) { + cntxt_cb(NULL, VSTATUS_TIMEOUT, cntxt_data, NULL); + return VSTATUS_TIMEOUT; + } + if ((madcntxt = cs_cntxt_get_nolock(&out_mad, &sm_async_send_rcv_cntxt, FALSE)) == NULL) { // could not get a context, this should not happen, discard packet IB_LOG_ERROR0("Error allocating an SM async send/rcv context"); @@ -1056,6 +1091,7 @@ sm_send_stl_request_impl(IBhandle_t fd, uint32_t method, uint32_t aid, return VSTATUS_BAD; } else { cs_cntxt_set_callback(madcntxt, cntxt_cb, cntxt_data); + madcntxt->totalTimeout = total_timeout; // send request out // if (smDebugPerf) { // smLogHelper(VS_LOG_WARN, "sm_send_request", "async SM send/rcv", aid, tid, @@ -1484,7 +1520,7 @@ sm_set_stl_attribute_async_dispatch_lr(IBhandle_t fd, uint32_t aid, uint32_t amo * Get SMInfo from the SM at port passed in. */ static Status_t -sm_getSmInfo(Node_t * nodep, Port_t * portp) +sm_getSmInfo(Topology_t * topop, Node_t * nodep, Port_t * portp) { uint8_t *path; STL_SM_INFO smInfo; @@ -1504,8 +1540,9 @@ sm_getSmInfo(Node_t * nodep, Port_t * portp) sm_nodeDescString(nodep), portp->portData->guid); /* remove the SM from our list */ (void) sm_dbsync_deleteSm(portp->portData->guid); - IB_EXIT(__func__, VSTATUS_OK); - return (VSTATUS_OK); + status = sm_popo_port_error(&sm_popo, topop, portp, status); + IB_EXIT(__func__, status); + return status; } else { /* * add the found Sm to the topology @@ -1521,160 +1558,11 @@ sm_getSmInfo(Node_t * nodep, Port_t * portp) } } - IB_EXIT(__func__, status); - return (status); + IB_EXIT(__func__, VSTATUS_OK); + return VSTATUS_OK; } /* sm_getSmInfo */ -//----------------------------------------------------------------------------// - -Status_t -sm_process_notice(Notice_t * noticep) -{ - Trap64_t *t64p; - Trap65_t *t65p; - Trap66_t *t66p; - Trap67_t *t67p; - Trap128_t *t128p; - Trap129_t *t129p; - Trap130_t *t130p; - Trap131_t *t131p; - Trap256_t *t256p; - Trap257_t *t257p; - Trap258_t *t258p; - SMTrap259_t *t259p; - Status_t status; - - IB_ENTER(__func__, noticep, 0, 0, 0); - -// -// If this is a vendor specific trap, then we really can't tell what -// to do with it. So, we don't process it. -// - if (noticep->generic == 0) { - IB_LOG_ERROR0("Notice is NOT generic"); - IB_EXIT(__func__, VSTATUS_OK); - return (VSTATUS_OK); - } -// -// A notice is really the same thing as a trap, except you need to poll -// for it instead of receiving it asynchronously. Hence, this routine -// can process both of them. -// - if (smDebugPerf) - IB_LOG_INFINI_INFO("Received Trap number", noticep->trapNumber); - - switch (noticep->trapNumber) { - case MAD_SMT_PORT_UP: - status = VSTATUS_AGAIN; - - t64p = (Trap64_t *) noticep; - IB_LOG_INFOX("Trap64: Issuer Lid", t64p->issuerLid); - break; - case MAD_SMT_PORT_DOWN: - status = VSTATUS_AGAIN; - - t65p = (Trap65_t *) noticep; - IB_LOG_INFOX("Trap65: Issuer Lid", t65p->issuerLid); - break; - case MAD_SMT_MCAST_GRP_CREATED: - status = VSTATUS_AGAIN; - - t66p = (Trap66_t *) noticep; - IB_LOG_INFOX("Trap66: Issuer Lid", t66p->issuerLid); - break; - case MAD_SMT_MCAST_GRP_DELETED: - status = VSTATUS_AGAIN; - - t67p = (Trap67_t *) noticep; - IB_LOG_INFOX("Trap67: Issuer Lid", t67p->issuerLid); - break; - case MAD_SMT_PORT_CHANGE: - status = VSTATUS_AGAIN; - - t128p = (Trap128_t *) noticep; - IB_LOG_INFOX("Trap128: Lid", t128p->lid); - break; - case MAD_SMT_LINK_INTEGRITY: - status = VSTATUS_AGAIN; - - t129p = (Trap129_t *) noticep; - IB_LOG_INFOX("Trap129: Lid ", t129p->lid); - IB_LOG_INFO("Trap129: Port", t129p->port); - break; - case MAD_SMT_BUF_OVERRUN: - status = VSTATUS_AGAIN; - - t130p = (Trap130_t *) noticep; - IB_LOG_INFOX("Trap130: Lid ", t130p->lid); - IB_LOG_INFO("Trap130: Port ", t130p->port); - break; - case MAD_SMT_FLOW_CONTROL: - status = VSTATUS_AGAIN; - - t131p = (Trap131_t *) noticep; - IB_LOG_INFOX("Trap131: Lid ", t131p->lid); - IB_LOG_INFO("Trap131: Port ", t131p->port); - break; - case MAD_SMT_BAD_MKEY: - status = VSTATUS_OK; - - t256p = (Trap256_t *) noticep; - if (IB_LOG_IS_INTERESTED(VS_LOG_INFO)) { - IB_LOG_INFOX("Trap256: Lid ", t256p->lid); - IB_LOG_INFO("Trap256: Method ", t256p->method); - IB_LOG_INFO("Trap256: Aid ", t256p->aid); - IB_LOG_INFO("Trap256: Amod ", t256p->amod); - } - break; - case MAD_SMT_BAD_PKEY: - status = VSTATUS_OK; - - t257p = (Trap257_t *) noticep; - if (IB_LOG_IS_INTERESTED(VS_LOG_INFO)) { - IB_LOG_INFOX("Trap257: Lid1 ", t257p->lid1); - IB_LOG_INFOX("Trap257: Lid2 ", t257p->lid2); - IB_LOG_INFOX("Trap257: Pkey ", t257p->key); - IB_LOG_INFO("Trap257: QP1 ", t257p->qp1); - IB_LOG_INFO("Trap257: QP2 ", t257p->qp2); - } - break; - case MAD_SMT_BAD_QKEY: - status = VSTATUS_OK; - - t258p = (Trap258_t *) noticep; - if (IB_LOG_IS_INTERESTED(VS_LOG_INFO)) { - IB_LOG_INFOX("Trap258: Lid1 ", t258p->lid1); - IB_LOG_INFOX("Trap258: Lid2 ", t258p->lid2); - IB_LOG_INFOX("Trap258: Qkey ", t258p->key); - IB_LOG_INFO("Trap258: QP1 ", t258p->qp1); - IB_LOG_INFO("Trap258: QP2 ", t258p->qp2); - } - break; - case MAD_SMT_BAD_PKEY_ONPORT: - status = VSTATUS_OK; - - t259p = (SMTrap259_t *) noticep; - if (IB_LOG_IS_INTERESTED(VS_LOG_INFO)) { - IB_LOG_INFOX("Trap259: Lid1 ", t259p->lid1); - IB_LOG_INFOX("Trap259: Lid2 ", t259p->lid2); - IB_LOG_INFOX("Trap259: Pkey ", t259p->pkey); - IB_LOG_INFO("Trap259: QP1 ", t259p->qp1); - IB_LOG_INFO("Trap259: QP2 ", t259p->qp2); - IB_LOG_INFOX("Trap259: SWLID ", t259p->swlidAddr); - IB_LOG_INFO("Trap259: PORT ", t259p->portNo); - } - break; - default: - status = VSTATUS_OK; - break; - } - - IB_EXIT(__func__, status); - return (status); -} - - int sm_check_node_cache_valid(Node_t * nodep) { @@ -2461,44 +2349,20 @@ static int sm_stl_authentic_node(Topology_t *tp, Node_t *cnp, Port_t *cpp, } -static void sm_stl_quarantine_node(Topology_t *tp, Node_t *cnp, Port_t *cpp, Node_t *qnp, uint32 quarantineReasons, STL_EXPECTED_NODE_INFO* expNodeInfo, const STL_PORT_INFO *pQPI) { - QuarantinedNode_t * qnodep; - - // allocate memory for quarantined node list entry - if (vs_pool_alloc(&sm_pool, sizeof(QuarantinedNode_t), (void *)&qnodep)) { - IB_LOG_WARN0("sm_setup_node: No memory for quarantined node entry"); - } else { - // add to SM/SA repository quarantined link list used by the SA - memset(qnodep, 0, sizeof(QuarantinedNode_t)); - qnodep->authenticNode = cnp; - qnodep->authenticNodePort = cpp; - qnodep->quarantinedNode = qnp; - qnodep->quarantineReasons = quarantineReasons; - memcpy(&qnodep->expNodeInfo, expNodeInfo, sizeof(STL_EXPECTED_NODE_INFO)); - Node_Enqueue(tp, qnodep, quarantined_node_head, quarantined_node_tail); - } - - if (cpp) - cpp->portData->neighborQuarantined = 1; - - // add to SM/SA repository quarantined map used by the SM - qnp->index = tp->num_quarantined_nodes++; - if (cpp && cl_qmap_insert(tp->quarantinedNodeMap, - cpp->portData->portInfo.NeighborNodeGUID, // nodeGUID may be falsified, check with neighbor. - &qnp->mapQuarantinedObj.item) == &qnp->mapQuarantinedObj.item) { - cl_qmap_set_obj(&qnp->mapQuarantinedObj, qnp); - } - +// Log the reasons the current node is being quarantined or bounced. +static void +sm_stl_quarantine_reasons(Topology_t *tp, Node_t *cnp, Port_t *cpp, Node_t *qnp, + uint32 quarantineReasons, STL_EXPECTED_NODE_INFO* expNodeInfo, const STL_PORT_INFO *pQPI) +{ if (pQPI) { - // Temporarily log an error until users become familar with this limitation (VL or MTU). if (quarantineReasons & STL_QUARANTINE_REASON_VL_COUNT) { - IB_LOG_ERROR_FMT(__func__, "Node:%s guid:"FMT_U64" type:%s port:%d. Supported VLs(%d) too small(needs => %d). Quarantined.", + IB_LOG_ERROR_FMT(__func__, "Node:%s guid:"FMT_U64" type:%s port:%d. Supported VLs(%d) too small(needs => %d).", sm_nodeDescString(qnp), qnp->nodeInfo.NodeGUID, StlNodeTypeToText(qnp->nodeInfo.NodeType), pQPI->LocalPortNum, pQPI->VL.s2.Cap, sm_config.min_supported_vls); return; } if (quarantineReasons & STL_QUARANTINE_REASON_SMALL_MTU_SIZE) { - IB_LOG_ERROR_FMT(__func__, "Node:%s guid:"FMT_U64" type:%s port:%d. Supported MTU(%s) too small(needs => 2048). Quarantined.", + IB_LOG_ERROR_FMT(__func__, "Node:%s guid:"FMT_U64" type:%s port:%d. Supported MTU(%s) too small(needs => 2048).", sm_nodeDescString(qnp), qnp->nodeInfo.NodeGUID, StlNodeTypeToText(qnp->nodeInfo.NodeType), pQPI->LocalPortNum, IbMTUToText(pQPI->MTU.Cap)); return; @@ -2527,6 +2391,40 @@ static void sm_stl_quarantine_node(Topology_t *tp, Node_t *cnp, Port_t *cpp, Nod } } +static void +sm_stl_quarantine_node(Topology_t *tp, Node_t *cnp, Port_t *cpp, Node_t *qnp, + uint32 quarantineReasons, STL_EXPECTED_NODE_INFO* expNodeInfo, const STL_PORT_INFO *pQPI) +{ + QuarantinedNode_t * qnodep; + + // allocate memory for quarantined node list entry + if (vs_pool_alloc(&sm_pool, sizeof(QuarantinedNode_t), (void *)&qnodep)) { + IB_LOG_WARN0("sm_stl_quarantine_node: No memory for quarantined node entry"); + } else { + // add to SM/SA repository quarantined link list used by the SA + memset(qnodep, 0, sizeof(QuarantinedNode_t)); + qnodep->authenticNode = cnp; + qnodep->authenticNodePort = cpp; + qnodep->quarantinedNode = qnp; + qnodep->quarantineReasons = quarantineReasons; + memcpy(&qnodep->expNodeInfo, expNodeInfo, sizeof(STL_EXPECTED_NODE_INFO)); + Node_Enqueue(tp, qnodep, quarantined_node_head, quarantined_node_tail); + } + + if (cpp) + cpp->portData->neighborQuarantined = 1; + + // add to SM/SA repository quarantined map used by the SM + qnp->index = tp->num_quarantined_nodes++; + if (cpp && cl_qmap_insert(tp->quarantinedNodeMap, + cpp->portData->portInfo.NeighborNodeGUID, // nodeGUID may be falsified, check with neighbor. + &qnp->mapQuarantinedObj.item) == &qnp->mapQuarantinedObj.item) { + cl_qmap_set_obj(&qnp->mapQuarantinedObj, qnp); + } + + sm_stl_quarantine_reasons(tp, cnp, cpp, qnp, quarantineReasons, expNodeInfo, pQPI); +} + // Examine the neighbor of the current node & port and add it to the topology. // @@ -2567,6 +2465,25 @@ sm_setup_node(Topology_t * topop, FabricData_t * pdtop, Node_t * cnp, Port_t * c IB_ENTER(__func__, topop, cnp, cpp, path); + // + // Skip quarantined ports. + // + if (cnp && cpp) { + if (sm_popo_is_port_quarantined(&sm_popo, cpp)) { + IB_LOG_WARN_FMT(__func__, "skipping port due to quarantine: node %s nodeGuid "FMT_U64" port %u", + sm_nodeDescString(cnp), cnp->nodeInfo.NodeGUID, cpp->index); + IB_EXIT(__func__, VSTATUS_BAD); + return VSTATUS_BAD; + } + if (sm_popo_is_node_quarantined(&sm_popo, cpp->portData->portInfo.NeighborNodeGUID)) { + IB_LOG_WARN_FMT(__func__, "skipping node due to quarantine: source node %s nodeGuid "FMT_U64" port %u; dest nodeGuid "FMT_U64, + sm_nodeDescString(cnp), cnp->nodeInfo.NodeGUID, cpp->index, + cpp->portData->portInfo.NeighborNodeGUID); + IB_EXIT(__func__, VSTATUS_BAD); + return VSTATUS_BAD; + } + } + memset(&expNodeInfo, 0, sizeof(STL_EXPECTED_NODE_INFO)); // @@ -2588,11 +2505,13 @@ sm_setup_node(Topology_t * topop, FabricData_t * pdtop, Node_t * cnp, Port_t * c if (!cpp && !cnp) { IB_LOG_ERRORRC("Get NodeInfo failed for local node. rc:", status); + status = VSTATUS_UNRECOVERABLE; } else { IB_LOG_WARN_FMT(__func__, - "Get NodeInfo failed for node off Port %d of Node " FMT_U64 - ":%s, status=%d", cpp->index, cnp->nodeInfo.NodeGUID, - sm_nodeDescString(cnp), status); + "Get NodeInfo failed for nodeGuid "FMT_U64" port %u, via node %s nodeGuid "FMT_U64" port %u; status=%d", + cpp->portData ? cpp->portData->portInfo.NeighborNodeGUID : 0, + cpp->portData ? cpp->portData->portInfo.NeighborPortNum : 0, + sm_nodeDescString(cnp), cnp->nodeInfo.NodeGUID, cpp->index, status); /* PR 105510 - set the topology changed flag if the node at other end was there on previous sweep */ if (topology_passcount @@ -2609,6 +2528,7 @@ sm_setup_node(Topology_t * topop, FabricData_t * pdtop, Node_t * cnp, Port_t * c nodep = NULL; } + status = sm_popo_port_error(&sm_popo, topop, cpp, status); } IB_EXIT(__func__, status); return (status); @@ -2637,12 +2557,12 @@ sm_setup_node(Topology_t * topop, FabricData_t * pdtop, Node_t * cnp, Port_t * c IB_EXIT(__func__, VSTATUS_BAD); return (VSTATUS_BAD); // Quarantine check - don't trust nodeInfo.NodeGUID. - } else if ( cpp && (nodep = sm_find_quarantined_guid(topop, cpp->portData->portInfo.NeighborNodeGUID))) { + } else if (cpp && (nodep = sm_find_quarantined_guid(topop, cpp->portData->portInfo.NeighborNodeGUID))) { IB_LOG_ERROR_FMT(__func__, - "Ignoring port connections to quarantined node %s guid " FMT_U64 "", - sm_nodeDescString(nodep), cpp->portData->portInfo.NeighborNodeGUID); + "Ignoring port connections to quarantined node %s guid " FMT_U64 " (1)", + sm_nodeDescString(nodep), cpp->portData->portInfo.NeighborNodeGUID); return (VSTATUS_BAD); - } + } portGuid = nodeInfo.PortGUID; portNumber = nodeInfo.u1.s.LocalPortNum; @@ -2675,35 +2595,37 @@ sm_setup_node(Topology_t * topop, FabricData_t * pdtop, Node_t * cnp, Port_t * c IB_LOG_ERRORRC ("sm_setup_node: Get NodeDesc failed for local node, rc:", status); + status = VSTATUS_UNRECOVERABLE; } else { IB_LOG_WARN_FMT(__func__, "Get NodeDesc failed for node off Port %d of Node " FMT_U64 ":%s, status = %d", cpp->index, cnp->nodeInfo.NodeGUID, sm_nodeDescString(cnp), status); + status = sm_popo_port_error(&sm_popo, topop, cpp, status); } - IB_EXIT(__func__, VSTATUS_BAD); - return (VSTATUS_BAD); + IB_EXIT(__func__, status); + return status; } // Get the connected-port PortInfo, and save for later. amod = portNumber; status = SM_Get_PortInfo(fd_topology, (1 << 24) | amod | STL_SM_CONF_START_ATTR_MOD, path, &conPortInfo); if (status != VSTATUS_OK) { - if(!cpp || !cnp) { IB_LOG_WARN_FMT(__func__, "Get Port Info failed for local port. Status = %d", status); - + status = VSTATUS_UNRECOVERABLE; } else { IB_LOG_WARN_FMT(__func__, "Get Port Info failed for port[%d] connected to Port %d of Node " FMT_U64 ":%s, status = %d", portNumber, cpp->index, cnp->nodeInfo.NodeGUID, sm_nodeDescString(cnp), status); + status = sm_popo_port_error(&sm_popo, topop, cpp, status); } - IB_EXIT(__func__, VSTATUS_BAD); - return (VSTATUS_BAD); + IB_EXIT(__func__, status); + return status; } else conPIp = &conPortInfo; // @@ -2760,18 +2682,7 @@ sm_setup_node(Topology_t * topop, FabricData_t * pdtop, Node_t * cnp, Port_t * c (void)sm_stl_quarantine_node(topop, cnp, cpp, nodep, quarantineReasons, &expNodeInfo, conPIp); } else { if (cpp && cnp) { - IB_LOG_WARN_FMT(__func__, "Neighbor of %s %s NodeGUID "FMT_U64" port %d could not be authenticated. Reports: " - "%s %s Guid "FMT_U64" Port %d: Actual: %s Guid "FMT_U64", Port %d)", - StlNodeTypeToText(cnp->nodeInfo.NodeType), - sm_nodeDescString(cnp), cnp->nodeInfo.NodeGUID, cpp->index, - //reports - StlNodeTypeToText(nodep->nodeInfo.NodeType), - sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, - nodep->nodeInfo.u1.s.LocalPortNum, - //actual - OpaNeighborNodeTypeToText(cpp->portData->portInfo.PortNeighborMode.NeighborNodeType), - cpp->portData->portInfo.NeighborNodeGUID, - cpp->portData->portInfo.NeighborPortNum); + sm_stl_quarantine_reasons(topop, cnp, cpp, nodep, quarantineReasons, &expNodeInfo, conPIp); IB_LOG_WARN_FMT(__func__, "Link was bounced instead of quarantined to disable potentially unsecure traffic."); } } @@ -2866,6 +2777,8 @@ sm_setup_node(Topology_t * topop, FabricData_t * pdtop, Node_t * cnp, Port_t * c } } else { + sm_popo_update_node(nodep->ponodep); + uint32 quarantineReasons = 0x00000000; // attacker may attempt to use valid node GUID of an existing node, so @@ -3133,6 +3046,10 @@ sm_setup_node(Topology_t * topop, FabricData_t * pdtop, Node_t * cnp, Port_t * c "Failed to get Switchinfo for node %s guid " FMT_U64 ": status = %d", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, status); + if ((status = sm_popo_port_error(&sm_popo, topop, swPortp, status)) == VSTATUS_TIMEOUT_LIMIT) { + IB_EXIT(__func__, status); + return status; + } } else { // if the switch supports adaptive routing, then allocate adaptive // routing related structures @@ -3206,14 +3123,14 @@ sm_setup_node(Topology_t * topop, FabricData_t * pdtop, Node_t * cnp, Port_t * c // Fill in our PortStateInfo information for this switch if((status = sm_get_node_port_states(topop, nodep, portp, path, &portStateInfo)) != VSTATUS_OK) { IB_LOG_WARN_FMT(__func__, "Unable to get PortStateInfo information for switch %s. Status: %d", - sm_nodeDescString(nodep), status); - if(portStateInfo != NULL) - vs_pool_free(&sm_pool, portStateInfo); - + sm_nodeDescString(nodep), status); + if ((status = sm_popo_port_error(&sm_popo, topop, swPortp, status)) == VSTATUS_TIMEOUT_LIMIT) { + IB_EXIT(__func__, status); + return status; + } } else { nodep->portStateInfo = portStateInfo; } - } else { start_port = portNumber; end_port = portNumber; @@ -3325,8 +3242,7 @@ sm_setup_node(Topology_t * topop, FabricData_t * pdtop, Node_t * cnp, Port_t * c } else { amod = portp->index; status = SM_Get_PortInfo(fd_topology, (1 << 24) | amod | STL_SM_CONF_START_ATTR_MOD, path, &portInfo); - - if (status != VSTATUS_OK) { // fill in Port[i] + if (status != VSTATUS_OK) { /* indicate a fabric change has been detected to insure paths-lfts-etc are recalculated */ if (topology_passcount && nodep->nodeInfo.NodeType == NI_TYPE_SWITCH) @@ -3336,6 +3252,7 @@ sm_setup_node(Topology_t * topop, FabricData_t * pdtop, Node_t * cnp, Port_t * c " [%s] Port %d; Ignoring port!", nodep->nodeInfo.NodeGUID, sm_nodeDescString(nodep), portp->index); sm_mark_link_down(topop, portp); + status = sm_popo_port_error(&sm_popo, topop, swPortp, status); goto cleanup_down_ports; } } @@ -3542,7 +3459,11 @@ sm_setup_node(Topology_t * topop, FabricData_t * pdtop, Node_t * cnp, Port_t * c if ((portp->portData->capmask & PI_CM_IS_SM) != 0) { /* get and save the SmInfo of the SM node for later processing */ /* Note: If we encountered a temporarily non-responding node, skip this step */ - (void) sm_getSmInfo(nodep, portp); + status = sm_getSmInfo(topop, nodep, portp); + if (status == VSTATUS_TIMEOUT_LIMIT) { + IB_EXIT(__func__, status); + return status; + } } } @@ -3733,7 +3654,7 @@ Node_t * sm_find_node_by_path(Topology_t * topop, Node_t * head, uint8_t * path) { uint8_t pathIndex; - Node_t *node_ptr; + Node_t *node_ptr; IB_ENTER(__func__, topop, path, 0, 0); @@ -3747,6 +3668,7 @@ sm_find_node_by_path(Topology_t * topop, Node_t * head, uint8_t * path) } node_ptr = head ? head : topop->node_head; + if (!node_ptr) { IB_EXIT(__func__, NULL); return NULL; @@ -3937,7 +3859,7 @@ sm_find_port_peer(Topology_t * topop, uint64_t node_guid, int32_t port_no) * Only return the port if if's active */ Port_t * -sm_find_active_port_lid(Topology_t * topop, Lid_t lid) +sm_find_active_port_lid(Topology_t * topop, STL_LID lid) { Port_t *portp = NULL; @@ -3947,7 +3869,7 @@ sm_find_active_port_lid(Topology_t * topop, Lid_t lid) } Port_t * -sm_find_port_lid(Topology_t * topop, Lid_t lid) +sm_find_port_lid(Topology_t * topop, STL_LID lid) { uint16_t topLid; Node_t *nodep = NULL; @@ -3997,9 +3919,9 @@ sm_find_port_lid(Topology_t * topop, Lid_t lid) } Port_t * -sm_find_node_and_port_lid(Topology_t * topop, Lid_t lid, Node_t ** nodePtr) +sm_find_node_and_port_lid(Topology_t * topop, STL_LID lid, Node_t ** nodePtr) { - Lid_t topLid; + STL_LID topLid; Node_t *nodep = NULL; Port_t *portp = NULL; @@ -4085,7 +4007,7 @@ sm_find_neighbor_node_and_port(Topology_t * topop, Port_t * portp, Node_t ** nod // pointers. // Status_t -sm_find_node_and_port_pair_lid(Topology_t * topop, Lid_t lid, uint32_t portIndex, +sm_find_node_and_port_pair_lid(Topology_t * topop, STL_LID lid, uint32_t portIndex, Node_t ** nodePtr, Port_t ** intPortPtr, Port_t ** extPortPtr, Node_t ** neighborNodePtr, Port_t ** neighborIntPortPtr, Port_t ** neighborExtPortPtr) @@ -4917,6 +4839,7 @@ sm_initialize_port(Topology_t * topop, Node_t * nodep, Port_t * portp, int use_l SM_INIT_PORT_PREP_CSM(); smCsmLogMessage(CSM_SEV_NOTICE, CSM_COND_FABRIC_INIT_ERROR, &localNode, &remoteNode, "Failed to set portinfo for node"); + status = sm_popo_port_error(&sm_popo, topop, portp, status); IB_EXIT(__func__, status); return (status); } @@ -5565,6 +5488,7 @@ sm_update_cableinfo(Topology_t * topop, Node_t * nodep, Port_t * portp) "Cannot get CableInfo for node %s nodeGuid " FMT_U64 " port %d status=%d madStatus %d", sm_nodeDescString(nodep), nodep->nodeInfo.NodeGUID, portp->index, status, madStatus); + status = sm_popo_port_error(&sm_popo, topop, portp, status); } goto fail; } @@ -6698,6 +6622,9 @@ sm_calculate_lft(Topology_t * topop, Node_t * switchp) return status; } + // Initialize port group top prior to setting up groups. + switchp->switchInfo.PortGroupTop = 0; + for_all_nodes(topop, nodep) { for_all_end_ports(nodep, portp) { if (sm_valid_port(portp) && portp->state > IB_PORT_DOWN) { @@ -6901,6 +6828,9 @@ sm_setup_lft(Topology_t * topop, Node_t * cnp) return status; } + // Initialize port group top prior to setting up groups. + cnp->switchInfo.PortGroupTop = 0; + for_all_nodes(topop, nodep) { for_all_end_ports(nodep, portp) { if (sm_valid_port(portp) && portp->state > IB_PORT_DOWN) { diff --git a/Esm/ib/src/smi/sm/stl_cca.c b/Esm/ib/src/smi/sm/stl_cca.c index e90f47da..8f161154 100644 --- a/Esm/ib/src/smi/sm/stl_cca.c +++ b/Esm/ib/src/smi/sm/stl_cca.c @@ -29,7 +29,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* [ICS VERSION STRING: unknown] */ -#include +#include #include "stl_cca.h" static Status_t build_cca_congestion_control_table(Node_t *nodep, Port_t *portp, STL_HFI_CONGESTION_CONTROL_TABLE *hfiCongCon, diff --git a/Esm/rpm_runmake b/Esm/rpm_runmake index 68c3aff5..01866b1d 100755 --- a/Esm/rpm_runmake +++ b/Esm/rpm_runmake @@ -37,16 +37,15 @@ ## the source tree of FM ## ## Usage: -## rpm_runmake [-V 'module_version'] [-B 'build_config'] [-n] +## rpm_runmake [-B 'build_config'] [-n] ## or -## rpm_runmake [-V 'module_version'] -r [-B 'build_config'] [-C] [-n] +## rpm_runmake -r [-B 'build_config'] [-C] [-n] ## ## Arguments: ## -B build_config release type to build, (debug/release). default is release ## -r rerun the build in place without doing a new checkout/tag ## -C don't clobber prior to the rerun ## -n No build. Useful for checking build machine -## -V module_version The MODULEVERSION define. ## ## In addition, the following environment variables are expected to be set: ## RELEASE_TAG, BRANCH_TAG, BUILD_TARGET, PRODUCT, RELEASE_HOME, BUILD_CONFIG @@ -73,9 +72,9 @@ Usage() { # include "ERROR" in message so weeklybuild catches it in error log echo "ERROR: rpm_runmake failed" >&2 - echo "Usage: rpm_runmake [-V 'module_version'] [-B 'build_config'] [-n]" >&2 + echo "Usage: rpm_runmake [-B 'build_config'] [-n]" >&2 echo " OR" >&2 - echo " rpm_runmake [-V 'module_version'] -r [-B 'build_config'] [-C] [-n]" >&2 + echo " rpm_runmake -r [-B 'build_config'] [-C] [-n]" >&2 exit 2 } @@ -89,26 +88,17 @@ showbuild() build_config= rerun=n Cflag=n -inplace=n -rpm=y -module_version= -while getopts V:B:riRCnS param +while getopts B:rCn param do case $param in r) rerun=y;; B) build_config="$OPTARG";; - i) - inplace=y;; - R) - rpm=n;; C) Cflag=y;; n) nflag=y;; - V) - module_version="$OPTARG";; ?) Usage esac @@ -123,7 +113,7 @@ fi if [ -z "$build_config" ] then # default to release build - export BUILD_CONFIG-release + export BUILD_CONFIG=release elif [ "$build_config" != debug -a "$build_config" != release ] then Usage @@ -151,7 +141,7 @@ then fi # when inplace developer builds have been done, the src rpm will include -# prebuilt code. if the -C option is not specified +# prebuilt code. if the -C option is not specified (via BUILD_ARGS) # clobber any such files if they are present (indicated by builtinplace file). # The clobber allows a src.rpm packaged with an in-place build to still # generate normally when -C not given. diff --git a/Esm/runmake b/Esm/runmake index 73750c60..c205df09 100755 --- a/Esm/runmake +++ b/Esm/runmake @@ -36,8 +36,6 @@ ## than simply a "make stage prepfiles" ## When this is invoked, the current directory will be the TL_DIR for a ## full checkout of the product to be built -## This is also invoked by the ALL_EMB runmake, in which case the current -## directory will be Esm while TL_DIR will be ALL_EMB ## ## Usage: ## runmake [-B 'build_config'] [-n] @@ -67,7 +65,7 @@ ## ## For developer builds (such as via dobuildall), the following combinations ## of the -r, -i, -C and -R options are useful -## -r - existing typical mode for developer builds +## -r - existing typical mode for developer builds ## - clobbers any existing built files ## - creates a src.rpm ## - builds in rpmbuild tree @@ -75,11 +73,11 @@ ## -r -C - behaves same as -r above except skips the clobber ## -r -i [-C] - incremental build mode for developer builds ## - clobbers any existing built files (unless -C specified) -## - builds SM code in place in source tree +## - builds code in place in source tree ## - src rpm contains pre-built code ## - rpmbuild ends up using pre-built code, creates binary rpm ## After this build, the developer may do incremental sub-tree builds -## using . Esm/setenv and then running make in the subtree +## using . setenv and then running make in the subtree ## -r -i [-C] -R - incremental build mode for developer builds with no rpms ## - same as -r -i [-C] except no rpms are created ## none of these options - typical production build @@ -97,15 +95,15 @@ ## For unit tests only needing a few binaries, they can also be ## directly tested. ## after initial attempt, if compile errors are limited to a subtree: -## create a new bash shell, use . ./Esm/setenv and then +## create a new bash shell, use . setenv and then ## iterate on make in the subtree and code changes until compiles ## -r -i -C - performs a build to generate rpms ## install the rpms and continue testing ## if focused on a few executables: -## create a new bash shell, use . ./Esm/setenv and then +## create a new bash shell, use . setenv and then ## iterate on make in the subtree and code changes and test of ## the individual binary until works properly -## -r - perform a full build and generate rpms +## -r - perform a full build and generate rpms ## install the rpms, confirm clean build, proper install and function ## ## Since weeklybuild and target commands always set BUILD_CONFIG, this @@ -116,7 +114,8 @@ # A given release will be targeted for a specific version of ofed # however we allow build.config to override if needed -export OFED_STACK_PREFIX=${OFED_STACK_PREFIX:-/usr/ofed-1.5.2} +#export OFED_STACK_PREFIX=${OFED_STACK_PREFIX:-/usr/ofed-1.5.2} +export OFED_STACK_PREFIX=${OFED_STACK_PREFIX:-/usr} # typically exported by build.config export BUILD_WITH_STACK=${BUILD_WITH_STACK:-OPENIB} @@ -134,10 +133,10 @@ Usage() build_config= rerun=n Cflag=n +nflag=n inplace=n rpm=y -args="$*" -while getopts B:riRCnS param +while getopts B:riRCn param do case $param in r) @@ -172,10 +171,6 @@ then rerun=y fi - - -# target will adjust TL_DIR to be our directory, hence it will be -# ALL_EMB/Esm when building in a ALL_EMB checkout resetct resetbsp target $BUILD_TARGET @@ -200,42 +195,35 @@ else export BUILD_CONFIG="$build_config" fi -if [ "$BUILD_WITH_STACK" = "OPENIB" ] +if [ ! -d $OFED_STACK_PREFIX ] then - if [ ! -d $OFED_STACK_PREFIX ] - then - echo "$0: ERROR: OFED stack not found: $OFED_STACK_PREFIX" >&2 - exit 1 - fi - echo "Stack to build for: $BUILD_WITH_STACK ($OFED_STACK_PREFIX)" -else - echo "Stack to build for: $BUILD_WITH_STACK" + echo "$0: ERROR: OFED stack not found: $OFED_STACK_PREFIX" >&2 + exit 1 fi +echo "---------------------------------------" +showenv +echo "---------------------------------------" + +echo "build for: $BUILD_TARGET" +echo "Stack to build for: $BUILD_WITH_STACK ($OFED_STACK_PREFIX)" + if [ "$nflag" = "y" ] then exit 0 fi -# Check if we need to build SRPM and start from there if [ "$BUILD_TARGET_OS" = "VXWORKS" ] then - echo "Err: Wrong runmake file" + echo "ERROR: Wrong runmake file" exit 1 fi -if [ "x${RELEASE_TAG}" = "x" ] -then - MODULEVERSION=`patch_engineer_version` - RPM_REL=`echo ${MODULEVERSION}|cut -d"." -f1-2` - RPM_VER=`echo ${MODULEVERSION}.999.999|cut -d"." -f3` -else - MODULEVERSION=`patch_version ${RELEASE_TAG}` - RPM_REL=`echo ${MODULEVERSION}|cut -d"." -f1-4` - RPM_VER=`echo ${MODULEVERSION}.999.999.999.999|cut -d"." -f5` -fi -export MKRPM_REL=${RPM_REL} -export MKRPM_VER=${RPM_VER}`rpm --eval %{?dist}` +MODULEVERSION=`$TL_DIR/MakeTools/convert_releasetag.pl $RELEASE_TAG` +RPM_VER=`echo $MODULEVERSION|cut -d"." -f1-4` +RPM_REL=`echo $MODULEVERSION.999.999.999.999|cut -d"." -f5` +export MKRPM_VER=$RPM_VER +export MKRPM_REL=$RPM_REL`rpm --eval %{?dist}` # even if building rpms, clobber to cleanup any previous in-place builds # so they don't end up inside the src.rpm when not wanted @@ -243,68 +231,39 @@ export MKRPM_VER=${RPM_VER}`rpm --eval %{?dist}` if [ "$rerun" = y -a "$Cflag" != y ] then # force full rebuild - # this clobber is only necessary if we have ever built inplace - # otherwise each rpm build will get a fresh workplace for its build - # so to save some time, only do the clobber if needed - #for build_config in $build_configs - #do - #export BUILD_CONFIG=$build_config - #if [ -e $TL_DIR/builtinplace.$PRODUCT.$BUILD_CONFIG \ - # -o -e $TL_DIR/builtinclude.$PRODUCT.$BUILD_CONFIG \ - # -o -e $TL_DIR/builtlibs.$PRODUCT.$BUILD_CONFIG \ - # -o -e $TL_DIR/builtbin.$PRODUCT.$BUILD_CONFIG ] - #then - export REMOVE_DEPENDS=yes - make clobber clobber_stage clobber_release - rm -f $TL_DIR/builtinplace.$PRODUCT.$BUILD_CONFIG - #fi - #done + # Clobber is really only necessary if we have ever built inplace + # but to be safe we always clobber just in case an aborted inplace + # build has previously occurred. + #if [ -e $TL_DIR/builtinplace.$PRODUCT.$BUILD_CONFIG \ + # -o -e $TL_DIR/builtinclude.$PRODUCT.$BUILD_CONFIG \ + # -o -e $TL_DIR/builtlibs.$PRODUCT.$BUILD_CONFIG \ + # -o -e $TL_DIR/builtbin.$PRODUCT.$BUILD_CONFIG ] + #then + export REMOVE_DEPENDS=yes + make clobber clobber_stage clobber_release + rm -f $TL_DIR/builtinplace.$PRODUCT.$BUILD_CONFIG + #fi fi -clobber_arg= rm -rf $TL_DIR/$PROJ_FILE_DIR/packaged_files $TL_DIR/$PROJ_FILE_DIR/dist_files +args= if [ "$inplace" = y ] then - #echo "Building $build_configs for allkernels for $BUILD_TARGET_OS $BUILD_TARGET ..." - echo "Building $BUILD_CONFIG for allkernels for $BUILD_TARGET_OS $BUILD_TARGET ..." - echo "===============================================================================" - #for build_config in $build_configs - #do - ## setup environment using BUILD_CONFIG - #export BUILD_CONFIG=$build_config - - #for os_version in $os_versions - #do - #setver $BUILD_TARGET_OS_VENDOR $os_version - echo > $TL_DIR/builtinplace.$PRODUCT.$BUILD_CONFIG - ./rpm_runmake -r -C -B $BUILD_CONFIG - #done - #done - args="$args -r -C" # we pre-built, so skip clobber in rpmbuild + # Do not use unifdef for inplace build + export USE_UNIFDEF="no" + echo > $TL_DIR/builtinplace.$PRODUCT.$BUILD_CONFIG + ./rpm_runmake -r -C -B $BUILD_CONFIG + args="-r -C" # we pre-built, so skip clobber in rpmbuild fi if [ "$rpm" = y ] then + USE_UNIFDEF=${USE_UNIFDEF:-"no"} set -x - # Copy the spec file for editing. - cp opa-fm.spec.base opa-fm.spec - - # Repair the spec file - sed -i "s/^Version:.*/Version: ${RPM_REL}/g" opa-fm.spec - sed -i "s/^Release:.*/Release: ${RPM_VER}%{?dist}/g" opa-fm.spec - if [ -d IbAccess ] ; then - sed -i "s/^%doc Esm\/README/%doc README/g" opa-fm.spec; - fi; - - # Pass command-line arguments to rpmbuild - sed -i "s/^\.\/fmbuild.*/\.\/fmbuild -V \%{version}\.\%{release} $args/g" opa-fm.spec - - # update distro dependencies - ./update_opa-fm_spec.sh # Pass env variables to rpmbuild. In integration build, - # Most of the rpmbuild environment variables remains the same except + # most of the rpmbuild environment variables remains the same except # a few (like TL_DIR). However, when the SRPM is built on another # different machine, the environment variables may be totally # different. In that case, we may want to pass (hardcode) some @@ -315,9 +274,9 @@ then echo "export BUILD_CONFIG=\${BUILD_CONFIG:-\"${BUILD_CONFIG}\"}" >> build.env echo "export BUILD_WITH_STACK=${BUILD_WITH_STACK}" >> build.env + FILES_TO_TAR= # if in-place build left builtbin, builtinclude and builtlibs, pick them up # to accelerate incremental builds - FILES_TO_TAR= for i in builtbin builtinclude builtlibs builtinplace do if [ -e $TL_DIR/$i.$PRODUCT.$BUILD_CONFIG ] @@ -325,35 +284,29 @@ then FILES_TO_TAR="$FILES_TO_TAR $i.$PRODUCT.$BUILD_CONFIG" fi done - cd ../ - #rm -rf rpmbuild - mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} + FILES_TO_TAR="$FILES_TO_TAR -T tar_inc_srcs_all" + + RPMDIR="$TL_DIR/rpmbuild" + mkdir -p $RPMDIR/{BUILD,SPECS,BUILDROOT,SOURCES,RPMS,SRPMS} + + # Update the spec file + cp opa-fm.spec.base opa-fm.spec + sed -i "s/^Version:.*/Version: ${RPM_VER}/g" opa-fm.spec + sed -i "s/^Release:.*/Release: ${RPM_REL}%{?dist}/g" opa-fm.spec + # update distro dependencies + ./update_opa-fm_spec.sh + mv opa-fm.spec $RPMDIR/SPECS/ + # Create source tar ball. Update licenses if needed. - if [[ "$RELEASE_TYPE" == "EMBARGOED" ]] - then - echo "Building Embargoed Release" - export OPA_LICENSE_DIR=${TL_DIR}/CodeTemplates/EmbargoedNotices - OWD=${PWD} - TMP=$(mktemp -d) - cp -rp * ${TMP} - cd ${TMP} - ${TL_DIR}/CodeTemplates/update_license.sh -c -q ${TMP} - tar -cvzf ${OWD}/rpmbuild/SOURCES/opa-fm.tar.gz -T Esm/tar_inc_srcs_all --exclude-vcs -X Esm/tar_exc_pattern $FILES_TO_TAR - cd ${OWD} - rm -rf ${TMP} - else - echo "Building Public Release" - tar -cvzf rpmbuild/SOURCES/opa-fm.tar.gz -T Esm/tar_inc_srcs_all --exclude-vcs -X Esm/tar_exc_pattern $FILES_TO_TAR - fi - cp Esm/opa-fm.spec rpmbuild/SPECS/ - cd rpmbuild - rpmbuild -ba --define "_topdir $(pwd)" SPECS/opa-fm.spec - cd ../Esm - make final_package + $TL_DIR/MakeTools/make_src_tar.sh "${RELEASE_TYPE}" "${TL_DIR}" "$USE_UNIFDEF" "$RPMDIR/SOURCES/opa-fm.tar.gz" "$FILES_TO_TAR" " -X tar_exc_pattern" || exit 1 + + ( + export BUILD_ARGS="$args" + cd $RPMDIR + rpmbuild -ba --define "_topdir $RPMDIR" SPECS/opa-fm.spec + ) || exit 1 - # Remove temp files - rm -f opafm.spec - rm -f build.env + make final_package fi exit 0 diff --git a/Esm/update_opa-fm_spec.sh b/Esm/update_opa-fm_spec.sh index 97fc7a6d..113472c2 100755 --- a/Esm/update_opa-fm_spec.sh +++ b/Esm/update_opa-fm_spec.sh @@ -19,9 +19,15 @@ fi if [ "$id" = "rhel" ] then - sed -i "s/__RPM_BLDRQ1/expat-devel, libibumad-devel, libibverbs-devel, libibmad-devel, openssl-devel/g" $to - st=$(echo "$versionid >= 7.0" | bc) - if [ $st = 1 ] + GE_7_0=$(echo "$versionid >= 7.0" | bc) + GE_7_4=$(echo "$versionid >= 7.4" | bc) + if [ $GE_7_4 = 1 ] + then + sed -i "s/__RPM_BLDRQ1/expat-devel, rdma-core-devel, libibmad-devel, openssl-devel/g" $to + else + sed -i "s/__RPM_BLDRQ1/expat-devel, libibumad-devel, libibverbs-devel, libibmad-devel, openssl-devel/g" $to + fi + if [ $GE_7_0 = 1 ] then sed -i "s/__RPM_BLDRQ2/BuildRequires: systemd %{?systemd_requires} %{?BuildRequires}/g" $to sed -i "s/__RPM_RQ1/Requires: systemd %{?systemd_requires}/g" $to @@ -36,9 +42,16 @@ then sed -i "/__RPM_DEBUG/,+1d" $to elif [ "$id" = "sles" ] then - sed -i "s/__RPM_BLDRQ1/libexpat-devel, libibumad-devel, libibverbs-devel, libibmad-devel, openssl-devel/g" $to - st=$(echo "$versionid >= 12.1" | bc) - if [ $st = 1 ] + GE_11_1=$(echo "$versionid >= 11.1" | bc) + GE_12_1=$(echo "$versionid >= 12.1" | bc) + GE_12_3=$(echo "$versionid >= 12.3" | bc) + if [ $GE_12_3 = 1 ] + then + sed -i "s/__RPM_BLDRQ1/libexpat-devel, rdma-core-devel, libibmad-devel, openssl-devel/g" $to + else + sed -i "s/__RPM_BLDRQ1/libexpat-devel, libibumad-devel, libibverbs-devel, libibmad-devel, openssl-devel/g" $to + fi + if [ $GE_12_1 = 1 ] then sed -i "s/__RPM_BLDRQ2/BuildRequires: systemd %{?systemd_requires} %{?BuildRequires}/g" $to sed -i "s/__RPM_RQ1/Requires: systemd %{?systemd_requires}/g" $to @@ -46,8 +59,7 @@ then sed -i "s/__RPM_BLDRQ2/Requires(post): /sbin/chkconfig/g" $to sed -i "s/__RPM_RQ1/Requires(preun): /sbin/chkconfig/g" $to fi - st=$(echo "$versionid >= 11.1" | bc) - if [ $st = 1 ] + if [ $GE_11_1 = 1 ] then sed -i "s/__RPM_DEBUG/%debug_package/g" $to else diff --git a/IbAccess/Common/Ibt/Bma/bmamain.c b/IbAccess/Common/Ibt/Bma/bmamain.c index 0a270b3c..22099201 100644 --- a/IbAccess/Common/Ibt/Bma/bmamain.c +++ b/IbAccess/Common/Ibt/Bma/bmamain.c @@ -324,7 +324,7 @@ BmaAddDevice( if (!g_BmaGlobalInfo->binitsuccess) { // Create the datagram pool - BufferSize = sizeof(PERF_MAD); + BufferSize = sizeof(MAD); status = iba_gsi_create_dgrm_pool(g_BmaGlobalInfo->GsaHandle, g_BmaSettings.MaxNDgrm, 1, diff --git a/IbAccess/Common/Ibt/Cm/cm_msg.h b/IbAccess/Common/Ibt/Cm/cm_msg.h index 017ad3d3..4655a4b9 100644 --- a/IbAccess/Common/Ibt/Cm/cm_msg.h +++ b/IbAccess/Common/Ibt/Cm/cm_msg.h @@ -39,7 +39,7 @@ extern "C" { #include "datatypes.h" #include "stl_types.h" -#include "stl_mad.h" +#include "stl_mad_priv.h" #include "ibyteswap.h" #include "ib_generalServices.h" diff --git a/IbAccess/Common/Ibt/Cm/cm_private.h b/IbAccess/Common/Ibt/Cm/cm_private.h index 3351182c..1850df72 100644 --- a/IbAccess/Common/Ibt/Cm/cm_private.h +++ b/IbAccess/Common/Ibt/Cm/cm_private.h @@ -55,7 +55,7 @@ extern "C" { #include "iquickmap.h" #include "ilist.h" #include "stl_types.h" -#include "stl_mad.h" +#include "stl_mad_priv.h" #include "stl_helper.h" #include "ib_gsi.h" #include "ibt.h" diff --git a/IbAccess/Common/Ibt/Gsa/gsamain.h b/IbAccess/Common/Ibt/Gsa/gsamain.h index 956f20b5..a5abeb61 100644 --- a/IbAccess/Common/Ibt/Gsa/gsamain.h +++ b/IbAccess/Common/Ibt/Gsa/gsamain.h @@ -34,7 +34,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "datatypes.h" #include "stl_types.h" -#include "stl_mad.h" +#include "stl_mad_priv.h" #include "vpi.h" #include "sma_osd.h" #include "ib_debug_osd.h" @@ -54,7 +54,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "imath.h" #include "isyscallback.h" #include "smagsa.h" -//#include "ContextMgr.h" #include "gsi_params.h" #if defined (__cplusplus) diff --git a/IbAccess/Common/Ibt/Sma/smagsa.h b/IbAccess/Common/Ibt/Sma/smagsa.h index bd0573f3..714adc2a 100644 --- a/IbAccess/Common/Ibt/Sma/smagsa.h +++ b/IbAccess/Common/Ibt/Sma/smagsa.h @@ -36,7 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "datatypes.h" #include "stl_types.h" -#include "stl_mad.h" +#include "stl_mad_priv.h" #include "vpi.h" #include "ieventthread.h" diff --git a/IbAccess/Common/Ibt/Sma/smamain.h b/IbAccess/Common/Ibt/Sma/smamain.h index 297206cc..bf7b10b9 100644 --- a/IbAccess/Common/Ibt/Sma/smamain.h +++ b/IbAccess/Common/Ibt/Sma/smamain.h @@ -36,7 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "datatypes.h" #include "stl_types.h" -#include "stl_mad.h" +#include "stl_mad_priv.h" #include "vpi.h" #include "sma_osd.h" #include "ib_debug_osd.h" diff --git a/IbAccess/Common/Ibt/Vca/ibt_utils.c b/IbAccess/Common/Ibt/Vca/ibt_utils.c index 6b97cc1c..76f37eb0 100644 --- a/IbAccess/Common/Ibt/Vca/ibt_utils.c +++ b/IbAccess/Common/Ibt/Vca/ibt_utils.c @@ -32,6 +32,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "imemory.h" #include "ib_debug.h" #include "ib_debug_osd.h" +#include "ib_generalServices.h" #include "precomp.h" #define ALLOC_TAG VCA_MEM_TAG diff --git a/IbAccess/Common/Inc/README b/IbAccess/Common/Inc/README index 250a1943..5ac11f6c 100644 --- a/IbAccess/Common/Inc/README +++ b/IbAccess/Common/Inc/README @@ -8,9 +8,6 @@ ib_pkt.h - IB Link, Network and Transport layer packet headers ib_sm.h - SMA/SMI packets ib_sd.h - Subnet Data interfaces for User and Kernel ib_generalServices.h - GSI packet headers -ib_pm.h - PMA packets -ib_cc.h - CCA packets -ib_dm.h - DMA packets ib_sa_records.h - SA packets diff --git a/IbAccess/Common/Inc/ib_cm.h b/IbAccess/Common/Inc/ib_cm.h index 04cf1cce..27c54177 100644 --- a/IbAccess/Common/Inc/ib_cm.h +++ b/IbAccess/Common/Inc/ib_cm.h @@ -749,7 +749,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "iba/public/datatypes.h" /* Portable datatypes */ #include "iba/vpi.h" #include "iba/stl_types.h" /* IB-defined types */ -#include "iba/stl_sa.h" /* PATH_RECORD */ +#include "iba/ib_sa_records_priv.h" /* PATH_RECORD */ #include "iba/ib_status.h" /* IB-defined status code */ #if defined (__cplusplus) diff --git a/IbAccess/Common/Inc/ib_generalServices.h b/IbAccess/Common/Inc/ib_generalServices.h index f094c51e..2c826d08 100644 --- a/IbAccess/Common/Inc/ib_generalServices.h +++ b/IbAccess/Common/Inc/ib_generalServices.h @@ -32,8 +32,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef __IBA_IB_GENERAL_SERVICES_H__ #define __IBA_IB_GENERAL_SERVICES_H__ (1) /* suppress duplicate loading of this file */ -#include "iba/stl_mad.h" -#include "iba/public/ibyteswap.h" +#include "iba/stl_mad_types.h" #ifdef __cplusplus extern "C" { @@ -46,10 +45,7 @@ extern "C" { * For each class, there is an additional header file which documents * specific attribute formats and Status codes specific to the class * For example: - * ib_pm.h - performance management - * ib_dm.h - device management * ib_sa_records.h - subnet administration - * ib_cc.h - congestion control */ /* these are valid in 1.0a and 1.1 @@ -210,23 +206,6 @@ typedef struct _SA_MAD { uint8 Data[STL_SUBN_ADM_DATASIZE]; } PACK_SUFFIX SA_MAD, *PSA_MAD; -/* -------------------------------------------------------------------------- */ -/* Performance Management MAD format */ -typedef struct _PERF_MAD { - MAD_COMMON common; /* Generic MAD Header */ - - uint8 Resv[40]; /* class specific header */ - - uint8 PerfData[IBA_GS_DATASIZE]; /* Performance Management Data */ -} PACK_SUFFIX PERF_MAD, *PPERF_MAD; - -typedef struct _STL_PERF_MAD { - MAD_COMMON common; /* Generic MAD Header */ - - uint8 PerfData[STL_GS_DATASIZE]; /* Performance Management Data */ -} PACK_SUFFIX STL_PERF_MAD, *PSTL_PERF_MAD; - - /* -------------------------------------------------------------------------- */ /* BaseBoard Management MAD format */ typedef struct _BM_HDR { diff --git a/IbAccess/Common/Inc/ib_gsi.h b/IbAccess/Common/Inc/ib_gsi.h index ce85581a..e4cb3e2a 100644 --- a/IbAccess/Common/Inc/ib_gsi.h +++ b/IbAccess/Common/Inc/ib_gsi.h @@ -38,7 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Kernel mode GSI interfaces */ #include "iba/vpi.h" -#include "iba/stl_mad.h" +#include "iba/stl_mad_priv.h" #if defined (__cplusplus) extern "C" { diff --git a/IbAccess/Common/Inc/ib_helper.h b/IbAccess/Common/Inc/ib_helper.h index 02b6b379..35ef6643 100644 --- a/IbAccess/Common/Inc/ib_helper.h +++ b/IbAccess/Common/Inc/ib_helper.h @@ -29,23 +29,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* [ICS VERSION STRING: unknown] */ -#if defined(CHECK_HEADERS) - -#ifndef _IBA_STL_HELPER_H_ -#warning FIX ME!!! Your includes should use the stl_helper.h header and not the ib_helper.h header for STL builds -#endif - -#endif - #ifndef _IBA_IB_HELPER_H_ #define _IBA_IB_HELPER_H_ #include "iba/stl_types.h" -#include "iba/stl_sm.h" -#include "iba/stl_pm.h" +#include "iba/stl_sm_types.h" #include "iba/ib_mad.h" -#include "iba/public/imemory.h" #include "iba/public/imath.h" #ifdef __cplusplus @@ -767,235 +757,6 @@ PortDataSetLinkSpeedEnabledSplit(uint8 speed, PORT_INFO *portInfop) portInfop->LinkSpeedExt.Enabled = speed >> 4; } -#if 0 /* not useful, handful of discads/millions packets is too small */ -/* compute Percent Xmit Discard packets as integer 0-10000 (2 decimal place) */ -static __inline uint16 -IbPortXmitDiscardPct100(uint16 PortXmitDiscards, uint64 PortXmitPkts) -{ - if (! PortXmitDiscards) - return 0; - return ((uint64)PortXmitDiscards * 10000)/(PortXmitPkts + PortXmitDiscards); -} -#endif - -/* indicate name for PortCongestion based on PortCheckRate type field */ -/* used by IbPrint for PA and PM queries */ -static __inline const char* -IbPortCongestionNameToText(uint16 portCheckRate) -{ - switch (portCheckRate & PM_VENDOR_PORT_COUNTERS_RATE_TYPE_MASK) { - case PM_VENDOR_PORT_COUNTERS_RATE_TYPE_CONG: - return "Port Xmit Congestion"; - case PM_VENDOR_PORT_COUNTERS_RATE_TYPE_PICO_TICK: - return "Port Xmit Wait"; - default: - return "Unknown"; - } -} - -/* indicate brief name for PortCongestion based on PortCheckRate type field */ -/* this is for use in opatop */ -static __inline const char* -IbPortCongestionNameToBriefText(uint16 portCheckRate) -{ - switch (portCheckRate & PM_VENDOR_PORT_COUNTERS_RATE_TYPE_MASK) { - case PM_VENDOR_PORT_COUNTERS_RATE_TYPE_CONG: - return "Port Xmt Congest*:"; - case PM_VENDOR_PORT_COUNTERS_RATE_TYPE_PICO_TICK: - return "Port Xmt Wait*: "; - default: - return "Unknown"; - } -} - -/* indicate name for Inefficiency based on PortCheckRate type field */ -/* used by IbPrint for PA and PM queries */ -static __inline const char* -IbPortInefficiencyNameToText(uint16 portCheckRate) -{ - switch (portCheckRate & PM_VENDOR_PORT_COUNTERS_RATE_TYPE_MASK) { - case PM_VENDOR_PORT_COUNTERS_RATE_TYPE_CONG: - return "Congestion Inefficiency"; - case PM_VENDOR_PORT_COUNTERS_RATE_TYPE_PICO_TICK: - return "Wait Inefficiency"; - default: - return "Unknown"; - } -} - -/* indicate brief name for Inefficiency based on PortCheckRate type field */ -/* this is for use in opatop */ -static __inline const char* -IbPortInefficiencyNameToBriefText(uint16 portCheckRate) -{ - switch (portCheckRate & PM_VENDOR_PORT_COUNTERS_RATE_TYPE_MASK) { - case PM_VENDOR_PORT_COUNTERS_RATE_TYPE_CONG: - return "Congest Inefficiency*:"; - case PM_VENDOR_PORT_COUNTERS_RATE_TYPE_PICO_TICK: - return "Wait Inefficiency*: "; - default: - return "Unknown"; - } -} - -/* convert PortCheckRate Type to Text */ -static __inline const char* -IbPortCheckRateTypeToText(uint16 portCheckRate) -{ - switch (portCheckRate & PM_VENDOR_PORT_COUNTERS_RATE_TYPE_MASK) { - case PM_VENDOR_PORT_COUNTERS_RATE_TYPE_CONG: - return "Port Check Rate"; - case PM_VENDOR_PORT_COUNTERS_RATE_TYPE_PICO_TICK: - return "Xmit Wait Tick"; - default: - return "Unknown"; - } -} -/* convert PortCheckRate Type to Text */ -static __inline const char* -IbPortCheckRateTypeSuffixToText(uint16 portCheckRate) -{ - switch (portCheckRate & PM_VENDOR_PORT_COUNTERS_RATE_TYPE_MASK) { - case PM_VENDOR_PORT_COUNTERS_RATE_TYPE_CONG: - return "per sec"; - case PM_VENDOR_PORT_COUNTERS_RATE_TYPE_PICO_TICK: - return "picosec"; - default: - return "Unknown"; - } -} - -/* compute Percent Congestion as an integer 0-1000 (1 decimal place) */ -/* this is used for PM_VENDOR_PORT_COUNTERS_RATE_TYPE_CONG - * in which case PortXmitCongestion indicates number of times that port - * was checked and had a deep queue depth (for 1 or more VLs) - * indicating congestion - * PortCheckRate is in units of checks per second - */ -static __inline uint16 -IbPortXmitCongestionPct10(uint16 PortCheckRate, uint16 interval, - uint64 PortXmitCongestion) -{ - uint32 portChecks; - // Note interval is limited to uint16 which is 3/4 of a day - // max expected PortXmitCongestion delta at 2000 check rate is < uint32 - // so math below will not overflow - if (! PortCheckRate) - return 0; - portChecks = (uint32)PortCheckRate * interval; - - // test for unexpected odd case in case delta is unexpectedly large - if (PortXmitCongestion > portChecks) - return 1000; // 100% - - return (PortXmitCongestion * 1000) / portChecks; -} - -/* compute Percent Congestion as an integer 0-1000 (1 decimal place) */ -/* this is used for PM_VENDOR_PORT_COUNTERS_RATE_TYPE_PICO_TICK - * in which case PortXmitCongestion indicates number of times that port - * was checked and had insufficient credits to xmit (for 1 or more VLs) - * indicating congestion - * PortCheckRate is in units of picoseconds per check - */ -static __inline uint16 -IbPortXmitWaitCongestionPct10(uint16 PortCheckRate, uint16 interval, - uint64 PortXmitCongestion) -{ - uint32 portCheckRate; // checks per millisecond - uint64 portChecks; // total checks over interval - // Note interval is limited to uint16 which is 3/4 of a day - // max expected PortXmitCongestion delta at 1000 picosecond checkrate - // is 6.5E13 which needs 46 bits - // at 1 picosecond checkrate and 3/4 of a day interval PortXmitCongestion - // delta could be 6.5E16 which needs 56 bits - // hence math below is careful to avoid overflow - // simple equation is: - // pct10 = (PortXmitCongestion * 1000) / (TicksPerSec * interval) - // where TicksPerSec= (10^12)/PortCheckRate - - - if (! PortCheckRate) - return 0; - - // test for unexpected odd case in case delta is unexpectedly large - // Factor out 1000 in denominator because result range is 0-1000 - // Factor out another 1000 in numerator and denominator, avoids overflow for - // large PortXmitCongestion but may introduce some modest rounding error - //if (PortXmitCongestion > (1000000ULL / PortCheckRate)) - // return 1000; // 100% - - // this value could take up to 30 bits - portCheckRate = (1000000000UL/PortCheckRate); // checks per millisecond - - // this value will fit in 46 bits - portChecks = portCheckRate * interval; // total checks over interval/1000 - - // because portChecks fits in 46 bits, we are safe doing simpler range test - if (PortXmitCongestion > portChecks*1000) - return 1000; // 100% - - return PortXmitCongestion / portChecks; // 0 - 1000 result -} - -/* compute Percent Inefficiency as an integer 0-1000 (1 decimal place) */ -/* We consider InEfficiency as the Percent of time the port was congested - * compared to the overall percent of time the port was sending data - */ -static __inline uint16 -IbPortXmitInefficiencyPct10(uint16 PortXmitCongestionPct10, - uint32 SendMBps, uint32 MaxMBps) -{ - uint16 SendUtilPct10; - if (! PortXmitCongestionPct10) - return 0; - SendUtilPct10 = ((uint64)SendMBps * 1000) / MaxMBps; - return (PortXmitCongestionPct10*1000)/ - (PortXmitCongestionPct10 + SendUtilPct10); -} - - -#if 0 // no way to clear PortXmitWait, so can't use for now -/* compute Percent XmitWait as an integer 0-1000 (1 decimal place) */ -static __inline uint16 -IbPortXmitWaitPct10(uint8 rate, uint16 interval, uint64 PortXmitWait) -{ - uint64 numerator, denominator; - - if (! PortXmitWait) - return 0; - - // Normally would multiply numerator by 1000 to get Pct10 - // and denominator by 1,000,000 to get MTicks to Ticks - // so instead just adjust multipliers and reduce chance of overflow - numerator=(uint64)pDelta->PortXmitWait; // ticks we had a delay, - // TBD - if use this in PM, pass MTickps as arg and lookup in static table - denominator=IbStaticRateToMTickps(rate) * interval * 1000; // ticks in interval - if (numerator > denominator*1000) - return 1000; // 100% - return numerator / denominator; -} -#endif - -/* convert Node Type to text */ -static __inline const char* -IbNodeTypeToText(NODE_TYPE type) -{ - return (type == IBA_NODE_CHANNEL_ADAPTER)?"CA": - (type == IBA_NODE_SWITCH)?"SW": - (type == IBA_NODE_ROUTER)?"RT":"??"; -} - -/* convert SM State to text */ -static __inline const char* -IbSMStateToText(SM_STATE state) -{ - return (state == SM_INACTIVE? "Inactive": - state == SM_DISCOVERING? "Discovering": - state == SM_STANDBY? "Standby": - state == SM_MASTER? "Master": "???"); -} - /* convert Notice Type to text */ static __inline const char* IbNoticeTypeToText(IB_NOTICE_TYPE type) @@ -1131,86 +892,6 @@ uint64 TimeoutMultToTimeInUsec(uint32 timeout_mult) } } -/* Convert Rnr NAK Timer value to usec */ -static __inline -uint32 RnrNakTimerToUsec(uint8 rnrNakTimer) -{ - switch (rnrNakTimer) - { - default: - case 0: return 655360; - case 1: return 10; - case 2: return 20; - case 3: return 30; - case 4: return 40; - case 5: return 60; - case 6: return 80; - case 7: return 120; - case 8: return 160; - case 9: return 240; - case 10: return 320; - case 11: return 480; - case 12: return 640; - case 13: return 960; - case 14: return 1280; - case 15: return 1920; - case 16: return 2560; - case 17: return 3840; - case 18: return 5120; - case 19: return 7680; - case 20: return 10240; - case 21: return 15360; - case 22: return 20480; - case 23: return 30720; - case 24: return 40960; - case 25: return 61440; - case 26: return 81920; - case 27: return 122880; - case 28: return 163840; - case 29: return 245760; - case 30: return 327680; - case 31: return 491520; - } -} - -/* Convert Usec to Rnr NAK Timer value */ -static __inline -uint8 UsecToRnrNakTimer(uint32 usec) -{ - if (usec <= 10) return 1; - else if (usec <= 20) return 2; - else if (usec <= 30) return 3; - else if (usec <= 40) return 4; - else if (usec <= 60) return 5; - else if (usec <= 80) return 6; - else if (usec <= 120) return 7; - else if (usec <= 160) return 8; - else if (usec <= 240) return 9; - else if (usec <= 320) return 10; - else if (usec <= 480) return 11; - else if (usec <= 640) return 12; - else if (usec <= 960) return 13; - else if (usec <= 1280) return 14; - else if (usec <= 1920) return 15; - else if (usec <= 2560) return 16; - else if (usec <= 3840) return 17; - else if (usec <= 5120) return 18; - else if (usec <= 7680) return 19; - else if (usec <= 10240) return 20; - else if (usec <= 15360) return 21; - else if (usec <= 20480) return 22; - else if (usec <= 30720) return 23; - else if (usec <= 40960) return 24; - else if (usec <= 61440) return 25; - else if (usec <= 81920) return 26; - else if (usec <= 122880) return 27; - else if (usec <= 163840) return 28; - else if (usec <= 245760) return 29; - else if (usec <= 327680) return 30; - else if (usec <= 491520) return 31; - else return 0; -} - /* convert capability mask into a text representation */ static __inline void FormatCapabilityMask(char buf[80], IB_CAPABILITY_MASK cmask) @@ -1239,27 +920,9 @@ void FormatCapabilityMask(char buf[80], IB_CAPABILITY_MASK cmask) cmask.s.IsSM?"SM ": ""); } -/* convert InitType into a text representation */ -static __inline -void FormatInitType(char buf[80], IB_PORT_INIT_TYPE value) -{ - snprintf(buf, 80, "%s%s%s%s", - value & PORT_INIT_TYPE_NOLOAD?"NL ": "", - value & PORT_INIT_TYPE_PRESERVE_CONTENT?"PC ": "", - value & PORT_INIT_TYPE_PRESERVE_PRESENCE?"PP ": "", - value & PORT_INIT_TYPE_DO_NOT_RESUSCITATE?"NR ": ""); -} - -/* value where we should round up to higher units at loss of output accuracy */ -#if 0 -/* old values, produces more precise output */ -#define FORMAT_MULT_THRESHOLD_FRACTION 9999 -#define FORMAT_MULT_THRESHOLD 9999 /* for seconds and minutes */ -#else -/* more human readable, slightly less precise */ #define FORMAT_MULT_THRESHOLD_FRACTION 1000 /* for fractions of a second */ #define FORMAT_MULT_THRESHOLD 180 /* for seconds and minutes */ -#endif + /* convert 4.096us*2^timeout to a reasonable value * and format into a buffer as #### uu * where uu is units and timeout is limited to 31 @@ -1447,23 +1110,6 @@ uint32 TimeoutTimeMsToMult(uint32 timeout_ms) return 31; /* 2.4 hr */ } -/* Returns TRUE if the LID is valid for the specified port attributes. */ -static __inline boolean -ValidateLid( - IN const IB_PORT_ATTRIBUTES* const pPortAttr, - IN const IB_LID Lid ) -{ - /* Compare the requested LID to see if it is within the port's */ - /* LID range. 2^LMC is the number of LIDs on this port. */ - if( Lid >= pPortAttr->Address.BaseLID && - Lid < (pPortAttr->Address.BaseLID + (1 << pPortAttr->Address.LMC)) ) - { - return TRUE; - } - - return FALSE; -} - /* using the LMC, convert a lid to the Source Path Bits for use in * and address vector */ @@ -1493,38 +1139,6 @@ PathBitsToLid( } -/* - * Return TRUE if the GID is valid for the specified port attributes. - */ -static __inline boolean -ValidateGid( - IN const IB_PORT_ATTRIBUTES* const pPortAttr, - IN const IB_GID* const pGid ) -{ - uint8 i; - - /* If the requested GID is built using the well-known GID type, */ - /* we only need to match on the port GUID. */ - if( (pGid->Type.Global.SubnetPrefix == DEFAULT_SUBNET_PREFIX) && - (pGid->Type.Global.InterfaceID == pPortAttr->GUID) ) - { - return TRUE; - } - - /* Compare the port's GIDs to see if the requested GID matches. */ - for( i = 0; i < pPortAttr->NumGIDs; i++ ) - { - if( !MemoryCompare( &pPortAttr->GIDTable[i], - pGid, sizeof( IB_GID ) ) ) - { - return TRUE; - } - } - - return FALSE; -} - - /* * Returns TRUE if the PKey value is valid for the specified port attributes. * Sets the PKeyIndex output value, if any, if a match is found. diff --git a/IbAccess/Common/Inc/ib_mad.h b/IbAccess/Common/Inc/ib_mad.h index 5d09e0d8..2b8a8883 100644 --- a/IbAccess/Common/Inc/ib_mad.h +++ b/IbAccess/Common/Inc/ib_mad.h @@ -29,19 +29,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* [ICS VERSION STRING: unknown] */ -#if defined(CHECK_HEADERS) - -#ifndef __IBA_STL_MAD_H__ -#warning FIX ME!!! Your includes should use the stl_mad.h header and not the ib_mad.h header for STL builds -#endif - -#endif - #ifndef __IBA_IB_MAD_H__ #define __IBA_IB_MAD_H__ #include "iba/public/datatypes.h" -#include "iba/vpi.h" /* Ths should be removed from here */ #include "iba/stl_types.h" @@ -77,7 +68,7 @@ extern "C" { #define MAD_BLOCK_SIZE STL_MAD_BLOCK_SIZE #define IB_BASE_VERSION 1 -/* use ib_generalServices.h or ib_sm.h to get proper class version */ +/* use ib_generalServices.h or ib_sm_types.h to get proper class version */ /* diff --git a/IbAccess/Common/Inc/ib_pa.h b/IbAccess/Common/Inc/ib_pa.h deleted file mode 100644 index 7757e181..00000000 --- a/IbAccess/Common/Inc/ib_pa.h +++ /dev/null @@ -1,826 +0,0 @@ -/* BEGIN_ICS_COPYRIGHT3 **************************************** - -Copyright (c) 2015, Intel Corporation - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of Intel Corporation nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -** END_ICS_COPYRIGHT3 ****************************************/ - -/* [ICS VERSION STRING: unknown] */ - -#if defined(CHECK_HEADERS) - -#ifndef _IBA_STL_PA_H_ -#warning FIX ME!!! Your includes should use the stl_pa.h header and not the ib_pa.h header for STL builds -#endif - -#endif - -#ifndef _IBA_IB_PA_H_ -#define _IBA_IB_PA_H_ (1) /* suppress duplicate loading of this file */ - -#include "iba/public/datatypes.h" -#include "iba/public/ibyteswap.h" -#include "iba/ib_generalServices.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Performance Management methods */ -#define PERFMGT_GET 0x01 /* MMTHD_GET */ -#define PERFMGT_SET 0x02 /* MMTHD_SET */ -#define PERFMGT_GET_RESP 0x81 /* MMTHD_GET_RESP */ - - -#include "iba/public/ipackon.h" - -/** PA MAD Payloads */ - -/* these should be the same as in pmlib.h */ -#define PM_UTIL_GRAN_PERCENT 10 /* granularity of utilization buckets */ -#define PM_UTIL_BUCKETS (100/PM_UTIL_GRAN_PERCENT) - -#define PM_ERR_GRAN_PERCENT 25 /* granularity of error buckets */ -#define PM_ERR_BUCKETS ((100/PM_ERR_GRAN_PERCENT)+1) // extra bucket is for those over threshold - -#define PM_MAX_GROUPS 10 -#define PM_GROUPNAMELEN 64 - -#define PORT_LIST_SIZE 1024 - -typedef struct _IMAGE_ID_DATA { - uint64 imageNumber; - int32 imageOffset; - uint32 reserved; -} PACK_SUFFIX IMAGE_ID_DATA; - -typedef struct _PMUTILSTATSTRUCT { - uint64 totalMBps; - uint64 totalKPps; - uint32 avgMBps; - uint32 minMBps; - uint32 maxMBps; - uint32 numBWBuckets; - uint32 BWBuckets[PM_UTIL_BUCKETS]; - uint32 avgKPps; - uint32 minKPps; - uint32 maxKPps; - uint32 reserved; -} PACK_SUFFIX PMUTILSTAT_T; - -// TBD - why not make names and sizes of fields consistent with ErrorSummary_t -// so can use simple macros to copy fields? -// TBD - same question for other structures here -typedef struct _PMERRSUMMARYSTRUCT { - uint32 integrityErrors; - uint32 congestion; - uint32 smaCongestion; - uint32 securityErrors; - uint32 routingErrors; - uint16 discard; - //uint16 waitPct10; - uint16 congestionPct10; - uint16 inefficiencyPct10; - uint16 reserved; - uint32 adaptiveRouting; -} PACK_SUFFIX PMERRSUMMARY_T; - -typedef struct _PMERRTHRESHOLDSTRUCT { - uint32 integrityErrors; - uint32 congestion; - uint32 smaCongestion; - uint32 securityErrors; - uint32 routingErrors; - uint32 reserved; -} PACK_SUFFIX PMERRTHRESHOLD_T; - -typedef struct PMERRBUCKETSTRUCT { - uint32 integrityErrors; - uint32 congestion; - uint32 smaCongestion; - uint32 securityErrors; - uint32 routingErrors; - uint32 reserved; -} PACK_SUFFIX PMERRBUCKET_T; - -typedef struct PMERRSTATSTRUCT { - PMERRSUMMARY_T categoryMaximums; - PMERRBUCKET_T ports[PM_ERR_BUCKETS]; -} PACK_SUFFIX PMERRSTAT_T; - - -typedef struct _GROUP_INFO_DATA { - char groupName[PM_GROUPNAMELEN]; // \0 terminated - IMAGE_ID_DATA imageId; - uint32 numInternalPorts; - uint32 numExternalPorts; - PMUTILSTAT_T internalUtilStats; - PMUTILSTAT_T sendUtilStats; - PMUTILSTAT_T recvUtilStats; - PMERRSTAT_T internalCategoryStats; - PMERRSTAT_T externalCategoryStats; - // these are added at the end to allow for forward and backward - // compatibility. - uint8 maxInternalRate; - uint8 minInternalRate; - uint8 maxExternalRate; - uint8 minExternalRate; - uint32 maxInternalMBps; - uint32 maxExternalMBps; -} PACK_SUFFIX GROUP_INFO_DATA; - - -typedef struct _GROUP_LIST_DATA { - uint32 numGroups; - char groupNames[PM_MAX_GROUPS][PM_GROUPNAMELEN]; // \0 terminated -} PACK_SUFFIX GROUP_LIST_DATA; - -// TBD - add nodeType? Port Guid? for SW have numPorts? add mtu, rate? add neighbor? -typedef struct _PORT_CONFIG_DATA { - uint64 nodeGuid; - char nodeDesc[64]; // can be 64 char w/o \0 - uint16 nodeLid; - uint8 portNumber; - uint8 reserved; - uint32 reserved2; -} PACK_SUFFIX PORT_CONFIG_DATA; - - -typedef struct _GROUP_CONFIG_DATA { - char groupName[PM_GROUPNAMELEN]; // \0 terminated - IMAGE_ID_DATA imageId; - uint32 numPorts; - uint32 reserved; - PORT_CONFIG_DATA portList[1]; -} PACK_SUFFIX GROUP_CONFIG_DATA; - -// is this still used? -typedef struct _GROUP_CONFIG_DATA2 { - char groupName[PM_GROUPNAMELEN]; // \0 terminated - IMAGE_ID_DATA imageId; - uint32 numPorts; - uint32 reserved; - PORT_CONFIG_DATA portList[500]; // need this to hold lots of ports in the response -} PACK_SUFFIX GROUP_CONFIG_DATA2; - -// PORT_COUNTERS_DATA.flags -#define PA_PC_FLAG_DELTA 0x00000001 // are these DELTA(1) or running totals -#define PA_PC_FLAG_UNEXPECTED_CLEAR 0x00000002 // was there an unexpected clear - -typedef struct _PORT_COUNTERS_DATA { - uint32 nodeLid; - uint32 portNumber; - uint32 flags; - uint32 reserved1; - uint16 SymbolErrorCounter; - uint8 LinkErrorRecoveryCounter; - uint8 LinkDownedCounter; - uint16 PortRcvErrors; - uint16 PortRcvRemotePhysicalErrors; - uint16 PortRcvSwitchRelayErrors; - uint16 PortXmitDiscards; - uint8 PortXmitConstraintErrors; - uint8 PortRcvConstraintErrors; - uint8 reserved2; - uint8 ExcessiveBufferOverrunErrors:4; - uint8 LocalLinkIntegrityErrors:4; - uint16 PortCheckRate; // see ib_pm.h for masks and meaning - uint16 VL15Dropped; - uint32 PortXmitWait; - uint64 PortXmitData; - uint64 PortRcvData; - uint64 PortXmitPkts; - uint64 PortRcvPkts; - uint64 PortXmitCongestion; - uint64 PortAdaptiveRouting; - uint16 CongestionPct10; - uint16 InefficiencyPct10; - uint32 reserved; - IMAGE_ID_DATA imageId; -} PACK_SUFFIX PORT_COUNTERS_DATA; - -typedef struct _CLR_PORT_COUNTERS_DATA { - uint32 nodeLid; - uint32 portNumber; - uint16 select; - uint16 reserved; -} PACK_SUFFIX CLR_PORT_COUNTERS_DATA; - -typedef struct _CLR_ALL_PORT_COUNTERS_DATA { - uint16 select; - uint16 reserved; - uint32 reserved2; -} PACK_SUFFIX CLR_ALL_PORT_COUNTERS_DATA; - -typedef struct _INTEGRITY_WEIGHTS { - uint8 symbolErrorCounter; - uint8 linkErrorRecoveryCounter; - uint8 linkDownedCounter; - uint8 portRcvErrors; - uint8 localLinkIntegrityErrors; - uint8 excessiveBufferOverrunErrors; - uint16 reserved; -} PACK_SUFFIX INTEGRITY_WEIGHTS_T; - -typedef struct _CONGESTION_WEIGHTS { - uint16 portXmitDiscard; - uint16 portXmitCongestionPct10; - uint16 portXmitInefficiencyPct10; - uint16 portXmitWaitCongestionPct10; - uint16 portXmitWaitInefficiencyPct10; - uint16 reserved; - uint16 reserved2; - uint16 reserved3; -} PACK_SUFFIX CONGESTION_WEIGHTS_T; - -// PM configuration flags for pmFlags below -#define PM_NONE 0 -#define PM_ENABLE_64BIT 0x000000001 // enable use of 64 bit counters -#define PM_ENABLE_SW_VENDOR 0x000000004 // enable use of SW vendor counters -#define PM_ENABLE_CA_VENDOR 0x000000008 // enable use of CA vendor counters -#define PM_CA_STATS 0x000000010 // monitor CA PMAs -#define PM_ENABLE_SW_VENDOR2 0x000000020 // enable use of SW vendor counters -#define PM_ENABLE_CA_VENDOR2 0x000000040 // enable use of CA vendor counters - -static __inline -void FormatPmFlags(char buf[80], uint32 pmFlags) -{ - snprintf(buf, 80, "%s%s%s%s", - pmFlags & PM_CA_STATS ? "" : "CaPmaAvoid ", - pmFlags & PM_ENABLE_64BIT ? "Pma64Enable " : "" , - pmFlags & PM_ENABLE_CA_VENDOR ? "PmaCaVendorEnable " : "", - pmFlags & PM_ENABLE_SW_VENDOR ? "PmaSwVendorEnable" : ""); -} - -static __inline -void FormatPmFlags2(char buf[80], uint32 pmFlags) -{ - snprintf(buf, 80, "%s%s", - pmFlags & PM_ENABLE_CA_VENDOR2 ? "PmaCaVendor2Enable " : "", - pmFlags & PM_ENABLE_SW_VENDOR2 ? "PmaSwVendor2Enable" : ""); -} - -typedef struct _PM_CONFIG_DATA { - uint32 sweepInterval; - uint32 MaxClients; - uint32 sizeHistory; - uint32 sizeFreeze; - uint32 lease; - uint32 pmFlags; - CONGESTION_WEIGHTS_T congestionWeights; - PMERRTHRESHOLD_T categoryThresholds; - INTEGRITY_WEIGHTS_T integrityWeights; - uint64 memoryFootprint; - uint32 MaxAttempts; - uint32 RespTimeout; - uint32 MinRespTimeout; - uint32 MaxParallelNodes; - uint32 PmaBatchSize; - uint8 ErrorClear; - uint8 reserved; - uint16 reserved2; - uint32 reserved3; -} PACK_SUFFIX PM_CONFIG_DATA; - -// TBD is value2 always guid? -typedef struct _FOCUS_PORT_ENTRY { - uint16 nodeLid; - uint8 portNumber; - IB_BITFIELD2(uint8, - rate:5, // IB_STATIC_RATE - mtu:3); // enum IB_MTU - uint32 index; - uint64 value; // list sorting factor - uint64 value2; // good place for GUID - char nodeDesc[64]; // can be 64 char w/o \0 - uint16 neighborLid; - uint8 neighborPortNumber; - uint8 reserved2; - uint32 reserved3; - uint64 neighborValue; - uint64 neighborGuid; - char neighborNodeDesc[64]; // can be 64 char w/o \0 -} PACK_SUFFIX FOCUS_PORT_ENTRY; - -typedef struct _FOCUS_PORTS_DATA { - char groupName[PM_GROUPNAMELEN]; // \0 terminated - IMAGE_ID_DATA imageId; - uint32 select; - uint32 start; - uint32 range; - uint32 numPorts; - FOCUS_PORT_ENTRY portList[1]; -} PACK_SUFFIX FOCUS_PORTS_DATA; - -// TBD - is this still used -typedef struct _FOCUS_PORTS_DATA2 { - char groupName[PM_GROUPNAMELEN]; // \0 terminated - IMAGE_ID_DATA imageId; - uint32 select; - uint32 start; - uint32 range; - uint32 numPorts; - FOCUS_PORT_ENTRY portList[500]; // need this to hold lots of ports in the response -} PACK_SUFFIX FOCUS_PORTS_DATA2; - -typedef struct _SMINFO_DATA { - uint16 lid; -#if CPU_LE - uint8 priority:4; - uint8 state:4; -#else - uint8 state:4; - uint8 priority:4; -#endif - uint8 portNumber; - uint32 reserved; - uint64 smPortGuid; - char smNodeDesc[64]; // can be 64 char w/o \0 -} PACK_SUFFIX SMINFO_DATA; - -typedef struct _IMAGE_INFO_DATA { - IMAGE_ID_DATA imageId; - uint64 sweepStart; - uint32 sweepDuration; - uint16 numHFIPorts; - uint16 numTFIPorts; - uint16 numRTRPorts; - uint16 numSwitchNodes; - uint32 numSwitchPorts; - uint32 numLinks; - uint32 numSMs; - uint32 numNoRespNodes; - uint32 numNoRespPorts; - uint32 numSkippedNodes; - uint32 numSkippedPorts; - uint32 numUnexpectedClearPorts; - uint32 reserved; - SMINFO_DATA SMInfo[2]; -} PACK_SUFFIX IMAGE_INFO_DATA; - -typedef struct _MOVE_FREEZE_DATA { - IMAGE_ID_DATA oldFreezeImage; - IMAGE_ID_DATA newFreezeImage; -} PACK_SUFFIX MOVE_FREEZE_DATA; - -/* End of packed data structures */ -#include "iba/public/ipackoff.h" - - - -/* Performance Analysis methods */ -#define PA_CMD_GET (0x01) -#define PA_CMD_GET_RESP (0x81) -#define PA_CMD_GETTABLE (0x12) -#define PA_CMD_GETTABLE_RESP (0x92) - - -#define MAD_PA_REPLY 0x80 // Reply bit for methods - -/* Performance Analysis attribute IDs */ - -#define PA_ATTRID_GET_CLASSPORTINFO 0x01 -#define PA_ATTRID_GET_GRP_LIST 0xA0 -#define PA_ATTRID_GET_GRP_INFO 0xA1 -#define PA_ATTRID_GET_GRP_CFG 0xA2 -#define PA_ATTRID_GET_PORT_CTRS 0xA3 -#define PA_ATTRID_CLR_PORT_CTRS 0xA4 -#define PA_ATTRID_CLR_ALL_PORT_CTRS 0xA5 -#define PA_ATTRID_GET_PM_CONFIG 0xA6 -#define PA_ATTRID_FREEZE_IMAGE 0xA7 -#define PA_ATTRID_RELEASE_IMAGE 0xA8 -#define PA_ATTRID_RENEW_IMAGE 0xA9 -#define PA_ATTRID_GET_FOCUS_PORTS 0xAA -#define PA_ATTRID_GET_IMAGE_INFO 0xAB -#define PA_ATTRID_MOVE_FREEZE_FRAME 0xAC - -/* Performance Analysis MAD status values */ - -#define MAD_STATUS_PA_UNAVAILABLE 0x0A00 // Engine unavailable -#define MAD_STATUS_PA_NO_GROUP 0x0B00 // No such group -#define MAD_STATUS_PA_NO_PORT 0x0C00 // Port not found - -/* PM Service Record values */ - -#define PM_SERVICE_NAME "Primary Intel OmniPath Performance Manager" -#define PM_SERVICE_ID (0x1100d03c34845555ull) -#define PM_VERSION 0x01 -#define PM_MASTER 0x01 /* master state */ -#define PM_STANDBY 0x02 /* standby state */ - -#define PA_DATA_OFFSET 32 - -#define PA_CLASS_VERSION 0x01 - -/* Selection values for focus */ - -#define PA_SELECT_UTIL_HIGH 0x00020001 // highest first, descending -#define PA_SELECT_UTIL_PKTS_HIGH 0x00020081 -#define PA_SELECT_UTIL_LOW 0x00020101 // lowest first, ascending -#define PA_SELECT_ERR_INTEG 0x00030001 // highest first, descending -#define PA_SELECT_ERR_SMACONG 0x00030002 -#define PA_SELECT_ERR_CONG 0x00030003 -#define PA_SELECT_ERR_SEC 0x00030004 -#define PA_SELECT_ERR_ROUT 0x00030005 -#define PA_SELECT_ERR_ADPTV_ROUT 0x00030006 - -#define IS_VALID_SELECT(s) (((s) == PA_SELECT_UTIL_HIGH) || ((s) == PA_SELECT_UTIL_PKTS_HIGH) || ((s) == PA_SELECT_UTIL_LOW) || ((s) == PA_SELECT_ERR_INTEG) ||\ - ((s) == PA_SELECT_ERR_SMACONG) || ((s) == PA_SELECT_ERR_CONG) || ((s) == PA_SELECT_ERR_SEC) || ((s) == PA_SELECT_ERR_ROUT) ||\ - ((s) == PA_SELECT_ERR_ADPTV_ROUT)) - -/* Performance Analysis Response Structures */ -#define PA_IMAGE_ID_NSIZE sizeof(IMAGE_ID_DATA) -#define PA_REC_DESC_LEN 64 -#define PA_TABLE_REC_DATA_LEN 512 -#define PA_RECORD_NSIZE sizeof(PaRecord_t) -#define PA_TABLE_RECORD_NSIZE sizeof(PaTableRecord_t) -#define PA_GROUP_LIST_NSIZE sizeof(GROUP_LIST_DATA) -#define PA_GROUP_INFO_NSIZE sizeof(GROUP_INFO_DATA) -#define PA_GROUP_CONFIG_NSIZE sizeof(GROUP_CONFIG_DATA) -#define PA_PORT_COUNTERS_NSIZE sizeof(PORT_COUNTERS_DATA) -#define PA_CLR_PORT_COUNTERS_NSIZE sizeof(CLR_PORT_COUNTERS_DATA) -#define PA_CLR_ALL_PORT_COUNTERS_NSIZE sizeof(CLR_ALL_PORT_COUNTERS_DATA) -#define PA_PM_CONFIG_NSIZE sizeof(PM_CONFIG_DATA) -#define PA_FOCUS_PORTS_NSIZE sizeof(FOCUS_PORTS_DATA) -#define PA_IMAGE_INFO_NSIZE sizeof(IMAGE_INFO_DATA) -#define PA_MOVE_FREEZE_NSIZE sizeof(MOVE_FREEZE_DATA) - -typedef struct PaRecord_s { - uint16_t fieldUint16; - uint16_t fieldFiller; - uint32_t fieldUint32; - uint64_t fieldUint64; - uint8_t desc[PA_REC_DESC_LEN]; -} PaRecord_t; - -typedef struct PaTableRecord_s { - uint16_t fieldUint16; - uint16_t fieldFiller; - uint32_t fieldUint32; - uint64_t fieldUint64; - uint8_t desc[PA_REC_DESC_LEN]; - uint8_t data[PA_TABLE_REC_DATA_LEN]; -} PaTableRecord_t; - -typedef struct _PA_TABLE_RECORD_RESULTS { - uint32 NumPaRecords; /* Number of PA Records returned */ - PaTableRecord_t PaRecords[1]; /* list of PA records returned */ -} PA_TABLE_RECORD_RESULTS, *PPA_TABLE_RECORD_RESULTS; - -typedef struct _PA_GROUP_LIST_RESULTS { - uint32 NumGroupListRecords; /* Number of PA Records returned */ - GROUP_LIST_DATA GroupListRecords[1]; /* list of PA records returned */ -} PA_GROUP_LIST_RESULTS, *PPA_GROUP_LIST_RESULTS; - -typedef struct _PA_GROUP_INFO_RESULTS { - uint32 NumGroupInfoRecords; /* Number of PA Records returned */ - GROUP_INFO_DATA GroupInfoRecords[1]; /* list of PA records returned */ -} PA_GROUP_INFO_RESULTS, *PPA_GROUP_INFO_RESULTS; - -typedef struct _PA_GROUP_CONFIG_RESULTS { - uint32 NumGroupConfigRecords; /* Number of PA Records returned */ - GROUP_CONFIG_DATA2 GroupConfigRecords[1]; /* list of PA records returned */ -} PA_GROUP_CONFIG_RESULTS, *PPA_GROUP_CONFIG_RESULTS; - -typedef struct _PA_PORT_COUNTERS_RESULTS { - uint32 NumPortCountersRecords; /* Number of PA Records returned */ - PORT_COUNTERS_DATA PortCountersRecords[1]; /* list of PA records returned */ -} PA_PORT_COUNTERS_RESULTS, *PPA_PORT_COUNTERS_RESULTS; - -typedef struct _PA_CLR_PORT_COUNTERS_RESULTS { - uint32 NumClrPortCountersRecords; /* Number of PA Records returned */ - CLR_PORT_COUNTERS_DATA ClrPortCountersRecords[1]; /* list of PA records returned */ -} PA_CLR_PORT_COUNTERS_RESULTS, *PPA_CLR_PORT_COUNTERS_RESULTS; - -typedef struct _PA_CLR_ALL_PORT_COUNTERS_RESULTS { - uint32 NumClrAllPortCountersRecords; /* Number of PA Records returned */ - CLR_ALL_PORT_COUNTERS_DATA ClrAllPortCountersRecords[1]; /* list of PA records returned */ -} PA_CLR_ALL_PORT_COUNTERS_RESULTS, *PPA_CLR_ALL_PORT_COUNTERS_RESULTS; - -typedef struct _PA_PM_CONFIG_RESULTS { - uint32 NumPmConfigRecords; /* Number of PA Records returned */ - PM_CONFIG_DATA PmConfigRecords[1]; /* list of PA records returned */ -} PA_PM_CONFIG_RESULTS, *PPA_PM_CONFIG_RESULTS; - -typedef struct _PA_IMAGE_ID_RESULTS { - uint32 NumImageIDRecords; /* Number of PA Records returned */ - IMAGE_ID_DATA ImageIDRecords[1]; /* list of PA records returned */ -} PA_IMAGE_ID_RESULTS, *PPA_IMAGE_ID_RESULTS; - -typedef struct _PA_FOCUS_PORTS_RESULTS { - uint32 NumFocusPortsRecords; /* Number of PA Records returned */ - FOCUS_PORTS_DATA2 FocusPortsRecords[1]; /* list of PA records returned */ -} PA_FOCUS_PORTS_RESULTS, *PPA_FOCUS_PORTS_RESULTS; - -typedef struct _PA_IMAGE_INFO_RESULTS { - uint32 NumImageInfoRecords; /* Number of PA Records returned */ - IMAGE_INFO_DATA ImageInfoRecords[1]; /* list of PA records returned */ -} PA_IMAGE_INFO_RESULTS, *PPA_IMAGE_INFO_RESULTS; - -typedef struct _PA_MOVE_FREEZE_RESULTS { - uint32 NumMoveFreezeRecords; /* Number of PA Records returned */ - MOVE_FREEZE_DATA MoveFreezeRecords[1]; /* list of PA records returned */ -} PA_MOVE_FREEZE_RESULTS, *PPA_MOVE_FREEZE_RESULTS; - -static __inline void -BSWAP_PA_RECORD(PaRecord_t *pRecord) -{ -#if CPU_LE - pRecord->fieldUint16 = ntoh16(pRecord->fieldUint16); - pRecord->fieldUint32 = ntoh32(pRecord->fieldUint32); - pRecord->fieldUint64 = ntoh64(pRecord->fieldUint64); -#endif /* CPU_LE */ -} - -static __inline void -BSWAP_PA_TABLE_RECORD(PaTableRecord_t *pRecord) -{ -#if CPU_LE - pRecord->fieldUint16 = ntoh16(pRecord->fieldUint16); - pRecord->fieldUint32 = ntoh32(pRecord->fieldUint32); - pRecord->fieldUint64 = ntoh64(pRecord->fieldUint64); -#endif /* CPU_LE */ -} - -static __inline void -BSWAP_PA_IMAGE_ID(IMAGE_ID_DATA *pRecord) -{ -#if CPU_LE - pRecord->imageNumber = ntoh64(pRecord->imageNumber); - pRecord->imageOffset = ntoh32(pRecord->imageOffset); -#endif /* CPU_LE */ -} - -static __inline void -BSWAP_PA_GROUP_INFO(GROUP_INFO_DATA *pRecord) -{ -#if CPU_LE - int i; - pRecord->numInternalPorts = ntoh32(pRecord->numInternalPorts); - pRecord->numExternalPorts = ntoh32(pRecord->numExternalPorts); - - pRecord->internalUtilStats.totalMBps = ntoh64(pRecord->internalUtilStats.totalMBps); - pRecord->internalUtilStats.totalKPps = ntoh64(pRecord->internalUtilStats.totalKPps); - pRecord->internalUtilStats.avgMBps = ntoh32(pRecord->internalUtilStats.avgMBps); - pRecord->internalUtilStats.minMBps = ntoh32(pRecord->internalUtilStats.minMBps); - pRecord->internalUtilStats.maxMBps = ntoh32(pRecord->internalUtilStats.maxMBps); - pRecord->internalUtilStats.numBWBuckets = ntoh32(pRecord->internalUtilStats.numBWBuckets); - for (i = 0; i < PM_UTIL_BUCKETS; i++) - pRecord->internalUtilStats.BWBuckets[i] = ntoh32(pRecord->internalUtilStats.BWBuckets[i]); - pRecord->internalUtilStats.avgKPps = ntoh32(pRecord->internalUtilStats.avgKPps); - pRecord->internalUtilStats.minKPps = ntoh32(pRecord->internalUtilStats.minKPps); - pRecord->internalUtilStats.maxKPps = ntoh32(pRecord->internalUtilStats.maxKPps); - - pRecord->sendUtilStats.totalMBps = ntoh64(pRecord->sendUtilStats.totalMBps); - pRecord->sendUtilStats.totalKPps = ntoh64(pRecord->sendUtilStats.totalKPps); - pRecord->sendUtilStats.avgMBps = ntoh32(pRecord->sendUtilStats.avgMBps); - pRecord->sendUtilStats.minMBps = ntoh32(pRecord->sendUtilStats.minMBps); - pRecord->sendUtilStats.maxMBps = ntoh32(pRecord->sendUtilStats.maxMBps); - pRecord->sendUtilStats.numBWBuckets = ntoh32(pRecord->sendUtilStats.numBWBuckets); - for (i = 0; i < PM_UTIL_BUCKETS; i++) - pRecord->sendUtilStats.BWBuckets[i] = ntoh32(pRecord->sendUtilStats.BWBuckets[i]); - pRecord->sendUtilStats.avgKPps = ntoh32(pRecord->sendUtilStats.avgKPps); - pRecord->sendUtilStats.minKPps = ntoh32(pRecord->sendUtilStats.minKPps); - pRecord->sendUtilStats.maxKPps = ntoh32(pRecord->sendUtilStats.maxKPps); - - pRecord->recvUtilStats.totalMBps = ntoh64(pRecord->recvUtilStats.totalMBps); - pRecord->recvUtilStats.totalKPps = ntoh64(pRecord->recvUtilStats.totalKPps); - pRecord->recvUtilStats.avgMBps = ntoh32(pRecord->recvUtilStats.avgMBps); - pRecord->recvUtilStats.minMBps = ntoh32(pRecord->recvUtilStats.minMBps); - pRecord->recvUtilStats.maxMBps = ntoh32(pRecord->recvUtilStats.maxMBps); - pRecord->recvUtilStats.numBWBuckets = ntoh32(pRecord->recvUtilStats.numBWBuckets); - for (i = 0; i < PM_UTIL_BUCKETS; i++) - pRecord->recvUtilStats.BWBuckets[i] = ntoh32(pRecord->recvUtilStats.BWBuckets[i]); - pRecord->recvUtilStats.avgKPps = ntoh32(pRecord->recvUtilStats.avgKPps); - pRecord->recvUtilStats.minKPps = ntoh32(pRecord->recvUtilStats.minKPps); - pRecord->recvUtilStats.maxKPps = ntoh32(pRecord->recvUtilStats.maxKPps); - - pRecord->internalCategoryStats.categoryMaximums.integrityErrors = ntoh32(pRecord->internalCategoryStats.categoryMaximums.integrityErrors); - pRecord->internalCategoryStats.categoryMaximums.congestion = ntoh32(pRecord->internalCategoryStats.categoryMaximums.congestion); - pRecord->internalCategoryStats.categoryMaximums.smaCongestion = ntoh32(pRecord->internalCategoryStats.categoryMaximums.smaCongestion); - pRecord->internalCategoryStats.categoryMaximums.securityErrors = ntoh32(pRecord->internalCategoryStats.categoryMaximums.securityErrors); - pRecord->internalCategoryStats.categoryMaximums.routingErrors = ntoh32(pRecord->internalCategoryStats.categoryMaximums.routingErrors); - pRecord->internalCategoryStats.categoryMaximums.discard = ntoh16(pRecord->internalCategoryStats.categoryMaximums.discard); - //pRecord->internalCategoryStats.categoryMaximums.waitPct10 = ntoh16(pRecord->internalCategoryStats.categoryMaximums.waitPct10); - pRecord->internalCategoryStats.categoryMaximums.congestionPct10 = ntoh16(pRecord->internalCategoryStats.categoryMaximums.congestionPct10); - pRecord->internalCategoryStats.categoryMaximums.inefficiencyPct10 = ntoh16(pRecord->internalCategoryStats.categoryMaximums.inefficiencyPct10); - pRecord->internalCategoryStats.categoryMaximums.adaptiveRouting = ntoh32(pRecord->internalCategoryStats.categoryMaximums.adaptiveRouting); - for (i = 0; i < PM_ERR_BUCKETS; i++) { - pRecord->internalCategoryStats.ports[i].integrityErrors = ntoh32(pRecord->internalCategoryStats.ports[i].integrityErrors); - pRecord->internalCategoryStats.ports[i].congestion = ntoh32(pRecord->internalCategoryStats.ports[i].congestion); - pRecord->internalCategoryStats.ports[i].smaCongestion = ntoh32(pRecord->internalCategoryStats.ports[i].smaCongestion); - pRecord->internalCategoryStats.ports[i].securityErrors = ntoh32(pRecord->internalCategoryStats.ports[i].securityErrors); - pRecord->internalCategoryStats.ports[i].routingErrors = ntoh32(pRecord->internalCategoryStats.ports[i].routingErrors); - } - - pRecord->externalCategoryStats.categoryMaximums.integrityErrors = ntoh32(pRecord->externalCategoryStats.categoryMaximums.integrityErrors); - pRecord->externalCategoryStats.categoryMaximums.congestion = ntoh32(pRecord->externalCategoryStats.categoryMaximums.congestion); - pRecord->externalCategoryStats.categoryMaximums.smaCongestion = ntoh32(pRecord->externalCategoryStats.categoryMaximums.smaCongestion); - pRecord->externalCategoryStats.categoryMaximums.securityErrors = ntoh32(pRecord->externalCategoryStats.categoryMaximums.securityErrors); - pRecord->externalCategoryStats.categoryMaximums.routingErrors = ntoh32(pRecord->externalCategoryStats.categoryMaximums.routingErrors); - pRecord->externalCategoryStats.categoryMaximums.discard = ntoh16(pRecord->externalCategoryStats.categoryMaximums.discard); - //pRecord->externalCategoryStats.categoryMaximums.waitPct10 = ntoh16(pRecord->externalCategoryStats.categoryMaximums.waitPct10); - pRecord->externalCategoryStats.categoryMaximums.congestionPct10 = ntoh16(pRecord->externalCategoryStats.categoryMaximums.congestionPct10); - pRecord->externalCategoryStats.categoryMaximums.inefficiencyPct10 = ntoh16(pRecord->externalCategoryStats.categoryMaximums.inefficiencyPct10); - pRecord->externalCategoryStats.categoryMaximums.adaptiveRouting = ntoh32(pRecord->externalCategoryStats.categoryMaximums.adaptiveRouting); - for (i = 0; i < PM_ERR_BUCKETS; i++) { - pRecord->externalCategoryStats.ports[i].integrityErrors = ntoh32(pRecord->externalCategoryStats.ports[i].integrityErrors); - pRecord->externalCategoryStats.ports[i].congestion = ntoh32(pRecord->externalCategoryStats.ports[i].congestion); - pRecord->externalCategoryStats.ports[i].smaCongestion = ntoh32(pRecord->externalCategoryStats.ports[i].smaCongestion); - pRecord->externalCategoryStats.ports[i].securityErrors = ntoh32(pRecord->externalCategoryStats.ports[i].securityErrors); - pRecord->externalCategoryStats.ports[i].routingErrors = ntoh32(pRecord->externalCategoryStats.ports[i].routingErrors); - } - pRecord->maxInternalMBps = ntoh32(pRecord->maxInternalMBps); - pRecord->maxExternalMBps = ntoh32(pRecord->maxExternalMBps); - BSWAP_PA_IMAGE_ID(&pRecord->imageId); -#endif /* CPU_LE */ -} - -static __inline void -BSWAP_PA_GROUP_LIST(GROUP_LIST_DATA *pRecord) -{ -#if CPU_LE - pRecord->numGroups = ntoh32(pRecord->numGroups); -#endif /* CPU_LE */ -} - -static __inline void -BSWAP_PA_GROUP_CONFIG(GROUP_CONFIG_DATA *pRecord, int toNetwork) -{ -#if CPU_LE - uint32 i; - if (!toNetwork) - pRecord->numPorts = ntoh32(pRecord->numPorts); - for (i = 0; i < pRecord->numPorts; i++) { - pRecord->portList[i].nodeLid = ntoh16(pRecord->portList[i].nodeLid); - pRecord->portList[i].nodeGuid = ntoh64(pRecord->portList[i].nodeGuid); - } - if (toNetwork) - pRecord->numPorts = ntoh32(pRecord->numPorts); - BSWAP_PA_IMAGE_ID(&pRecord->imageId); -#endif /* CPU_LE */ -} - -static __inline void -BSWAP_PA_PORT_COUNTERS(PORT_COUNTERS_DATA *pRecord) -{ -#if CPU_LE - pRecord->nodeLid = ntoh32(pRecord->nodeLid); - pRecord->portNumber = ntoh32(pRecord->portNumber); - pRecord->flags = ntoh32(pRecord->flags); - pRecord->SymbolErrorCounter = ntoh16(pRecord->SymbolErrorCounter); - pRecord->PortRcvErrors = ntoh16(pRecord->PortRcvErrors); - pRecord->PortRcvRemotePhysicalErrors = ntoh16(pRecord->PortRcvRemotePhysicalErrors); - pRecord->PortRcvSwitchRelayErrors = ntoh16(pRecord->PortRcvSwitchRelayErrors); - pRecord->PortXmitDiscards = ntoh16(pRecord->PortXmitDiscards); - pRecord->PortCheckRate = ntoh16(pRecord->PortCheckRate); - pRecord->VL15Dropped = ntoh16(pRecord->VL15Dropped); - pRecord->PortXmitWait = ntoh32(pRecord->PortXmitWait); - pRecord->PortXmitData = ntoh64(pRecord->PortXmitData); - pRecord->PortRcvData = ntoh64(pRecord->PortRcvData); - pRecord->PortXmitPkts = ntoh64(pRecord->PortXmitPkts); - pRecord->PortRcvPkts = ntoh64(pRecord->PortRcvPkts); - pRecord->PortXmitCongestion = ntoh64(pRecord->PortXmitCongestion); - pRecord->PortAdaptiveRouting = ntoh64(pRecord->PortAdaptiveRouting); - pRecord->CongestionPct10 = ntoh16(pRecord->CongestionPct10); - pRecord->InefficiencyPct10 = ntoh16(pRecord->InefficiencyPct10); - BSWAP_PA_IMAGE_ID(&pRecord->imageId); -#endif /* CPU_LE */ -} - -static __inline void -BSWAP_PA_CLR_PORT_COUNTERS(CLR_PORT_COUNTERS_DATA *pRecord) -{ -#if CPU_LE - pRecord->nodeLid = ntoh32(pRecord->nodeLid); - pRecord->portNumber = ntoh32(pRecord->portNumber); - pRecord->select = ntoh16(pRecord->select); -#endif /* CPU_LE */ -} - -static __inline void -BSWAP_PA_CLR_ALL_PORT_COUNTERS(CLR_ALL_PORT_COUNTERS_DATA *pRecord) -{ -#if CPU_LE - pRecord->select = ntoh16(pRecord->select); -#endif /* CPU_LE */ -} - -static __inline void -BSWAP_PA_PM_CONFIG(PM_CONFIG_DATA *pRecord) -{ -#if CPU_LE - pRecord->sweepInterval = ntoh32(pRecord->sweepInterval); - pRecord->MaxClients = ntoh32(pRecord->MaxClients); - pRecord->sizeHistory = ntoh32(pRecord->sizeHistory); - pRecord->sizeFreeze = ntoh32(pRecord->sizeFreeze); - pRecord->lease = ntoh32(pRecord->lease); - pRecord->pmFlags = ntoh32(pRecord->pmFlags); - pRecord->congestionWeights.portXmitDiscard = ntoh16(pRecord->congestionWeights.portXmitDiscard); - pRecord->congestionWeights.portXmitCongestionPct10 = ntoh16(pRecord->congestionWeights.portXmitCongestionPct10); - pRecord->congestionWeights.portXmitInefficiencyPct10 = ntoh16(pRecord->congestionWeights.portXmitInefficiencyPct10); - pRecord->congestionWeights.portXmitWaitCongestionPct10 = ntoh16(pRecord->congestionWeights.portXmitWaitCongestionPct10); - pRecord->congestionWeights.portXmitWaitInefficiencyPct10 = ntoh16(pRecord->congestionWeights.portXmitWaitInefficiencyPct10); - pRecord->categoryThresholds.integrityErrors = ntoh32(pRecord->categoryThresholds.integrityErrors); - pRecord->categoryThresholds.congestion = ntoh32(pRecord->categoryThresholds.congestion); - pRecord->categoryThresholds.smaCongestion = ntoh32(pRecord->categoryThresholds.smaCongestion); - pRecord->categoryThresholds.securityErrors = ntoh32(pRecord->categoryThresholds.securityErrors); - pRecord->categoryThresholds.routingErrors = ntoh32(pRecord->categoryThresholds.routingErrors); - pRecord->memoryFootprint = ntoh64(pRecord->memoryFootprint); - pRecord->MaxAttempts = ntoh32(pRecord->MaxAttempts); - pRecord->RespTimeout = ntoh32(pRecord->RespTimeout); - pRecord->MinRespTimeout = ntoh32(pRecord->MinRespTimeout); - pRecord->MaxParallelNodes = ntoh32(pRecord->MaxParallelNodes); - pRecord->PmaBatchSize = ntoh32(pRecord->PmaBatchSize); - // ErrorClear is uint8 -#endif /* CPU_LE */ -} - -static __inline void -BSWAP_PA_FOCUS_PORTS(FOCUS_PORTS_DATA *pRecord, int toNetwork) -{ -#if CPU_LE - uint32 i; - pRecord->select = ntoh32(pRecord->select); - pRecord->start = ntoh32(pRecord->start); - pRecord->range = ntoh32(pRecord->range); - if (!toNetwork) - pRecord->numPorts = ntoh32(pRecord->numPorts); - for (i = 0; i < pRecord->numPorts; i++) { - pRecord->portList[i].nodeLid = ntoh16(pRecord->portList[i].nodeLid); - pRecord->portList[i].index = ntoh32(pRecord->portList[i].index); - pRecord->portList[i].value = ntoh64(pRecord->portList[i].value); - pRecord->portList[i].neighborLid = ntoh16(pRecord->portList[i].neighborLid); - pRecord->portList[i].neighborValue = ntoh64(pRecord->portList[i].neighborValue); - pRecord->portList[i].value2 = ntoh64(pRecord->portList[i].value2); - pRecord->portList[i].neighborGuid = ntoh64(pRecord->portList[i].neighborGuid); - } - if (toNetwork) - pRecord->numPorts = ntoh32(pRecord->numPorts); - BSWAP_PA_IMAGE_ID(&pRecord->imageId); -#endif /* CPU_LE */ -} - -static __inline void -BSWAP_PA_IMAGE_INFO(IMAGE_INFO_DATA *pRecord) -{ -#if CPU_LE - int i; - BSWAP_PA_IMAGE_ID(&pRecord->imageId); - pRecord->sweepStart = ntoh64(pRecord->sweepStart); - pRecord->sweepDuration = ntoh32(pRecord->sweepDuration); - pRecord->numHFIPorts = ntoh16(pRecord->numHFIPorts); - pRecord->numTFIPorts = ntoh16(pRecord->numTFIPorts); - pRecord->numRTRPorts = ntoh16(pRecord->numRTRPorts); - pRecord->numSwitchNodes = ntoh16(pRecord->numSwitchNodes); - pRecord->numSwitchPorts = ntoh32(pRecord->numSwitchPorts); - pRecord->numLinks = ntoh32(pRecord->numLinks); - pRecord->numSMs = ntoh32(pRecord->numSMs); - pRecord->numNoRespNodes = ntoh32(pRecord->numNoRespNodes); - pRecord->numNoRespPorts = ntoh32(pRecord->numNoRespPorts); - pRecord->numSkippedNodes = ntoh32(pRecord->numSkippedNodes); - pRecord->numSkippedPorts = ntoh32(pRecord->numSkippedPorts); - pRecord->numUnexpectedClearPorts = ntoh32(pRecord->numUnexpectedClearPorts); - for (i = 0; i < 2; i++) { - pRecord->SMInfo[i].lid = ntoh16(pRecord->SMInfo[i].lid); - pRecord->SMInfo[i].smPortGuid = ntoh64(pRecord->SMInfo[i].smPortGuid); - } -#endif /* CPU_LE */ -} - -static __inline void -BSWAP_PA_MOVE_FREEZE(MOVE_FREEZE_DATA *pRecord) -{ -#if CPU_LE - BSWAP_PA_IMAGE_ID(&pRecord->oldFreezeImage); - BSWAP_PA_IMAGE_ID(&pRecord->newFreezeImage); -#endif /* CPU_LE */ -} - -#ifdef __cplusplus -} -#endif - -#endif /* _IBA_IB_PA_H_ */ diff --git a/IbAccess/Common/Inc/ib_pm.h b/IbAccess/Common/Inc/ib_pm.h deleted file mode 100644 index 868464c7..00000000 --- a/IbAccess/Common/Inc/ib_pm.h +++ /dev/null @@ -1,1022 +0,0 @@ -/* BEGIN_ICS_COPYRIGHT3 **************************************** - -Copyright (c) 2015, Intel Corporation - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of Intel Corporation nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -** END_ICS_COPYRIGHT3 ****************************************/ - -/* [ICS VERSION STRING: unknown] */ - -#if defined(CHECK_HEADERS) - -#ifndef __IBA_STL_PM_H__ -#warning FIX ME!!! Your includes should use the stl_pm.h header and not the ib_pm.h header for STL builds -#endif - -#endif - -#ifndef _IBA_IB_PM_H_ -#define _IBA_IB_PM_H_ (1) /* suppress duplicate loading of this file */ - -#include "iba/public/datatypes.h" -#include "iba/public/ibyteswap.h" -#include "iba/ib_generalServices.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Performance Management methods */ -#define PERFMGT_GET 0x01 /* MMTHD_GET */ -#define PERFMGT_SET 0x02 /* MMTHD_SET */ -#define PERFMGT_GET_RESP 0x81 /* MMTHD_GET_RESP */ - - -/* Performance Management Attributes IDs */ /* Attribute Modifier values */ -#define PM_ATTRIB_ID_CLASS_PORTINFO 0x0001 /* 0x0000_0000 */ -#define PM_ATTRIB_ID_PORT_SAMPLES_CONTROL 0x0010 /* 0x0000_0000 - 0xFFFF_FFFF */ - /* sampling mechanism, FFFFFFFF -> all */ -#define PM_ATTRIB_ID_PORT_SAMPLES_RESULT 0x0011 /* 0x0000_0000 - 0xFFFF_FFFF */ - /* sampling mechanism, FFFFFFFF -> all */ -#define PM_ATTRIB_ID_PORT_COUNTERS 0x0012 /* 0x0000_0000 */ -/* optional attributes */ -#define PM_ATTRIB_ID_PORT_RCV_ERROR_DETAILS 0x0015 /* 0x0000_0000 */ -#define PM_ATTRIB_ID_PORT_XMIT_DISCARD_DETAILS 0x0016 /* 0x0000_0000 */ -#define PM_ATTRIB_ID_PORT_OP_RCV_COUNTERS 0x0017 /* 0x0000_0000 */ -#define PM_ATTRIB_ID_PORT_FLOW_CTL_COUNTERS 0x0018 /* 0x0000_0000 */ -#define PM_ATTRIB_ID_PORT_VL_OP_PACKETS 0x0019 /* 0x0000_0000 */ -#define PM_ATTRIB_ID_PORT_VL_OP_DATA 0x001A /* 0x0000_0000 */ -#define PM_ATTRIB_ID_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS 0x001B /* 0x0000_0000 */ -#define PM_ATTRIB_ID_PORT_VL_XMIT_WAIT_COUNTERS 0x001C /* 0x0000_0000 */ -#define PM_ATTRIB_ID_PORT_COUNTERS_EXTENDED 0x001D /* 0x0000_0000 */ -#define PM_ATTRIB_ID_PORT_SAMPLES_RESULT_EXTENDED 0x001E /* 0x0000_0000 */ -#define PM_ATTRIB_ID_SW_PORT_VL_CONGESTION 0x0030 /* 0x0000_0000 */ -#define PM_ATTRIB_ID_VENDOR_PORT_COUNTERS 0xff00 /* 0xCC00_00PP */ - -#include "iba/public/ipackon.h" - -/* if AllPortSelect capability, use this as PortNum to operate on all ports */ -#define PM_ALL_PORT_SELECT 0xff - -/* - * PMA Class Port Info - */ - - /* Class-specific Capability Mask bits */ -#define PM_CLASS_PORT_CAPMASK_SAMPLES_ONLY_SUPPORTED 0x0800 - /* PortSamplesControl values which can be sampled but not polled - * are available - */ - -#define PM_CLASS_PORT_CAPMASK_PORT_COUNTERS_XMIT_WAIT_SUPPORTED 0x1000 - /* PortCounters:PortXmitWait supported */ - - /* Vendor-specific Capability Mask2 bits */ -#define PM_CLASS_PORT_CAPMASK2_VENDOR_PORT_COUNTERS 0x04000000 - /* TrueScale VENDOR_PORT_COUNTERS attribute is supported */ - -#define PM_CLASS_PORT_CAPMASK2_VENDOR_PORT_COUNTERS2 0x02000000 - /* TrueScale VENDOR_PORT_COUNTERS allows clear thresholds */ - -/* CounterSelect values in PortSamplesControl */ -typedef enum _SAMPLE_SELECT { - /* 0x0000 reserved */ - SELECT_PORT_XMIT_DATA = 0x0001, - SELECT_PORT_RCV_DATA = 0x0002, - SELECT_PORT_XMIT_PKTS = 0x0003, - SELECT_PORT_RCV_PKTS = 0x0004, - SELECT_PORT_XMIT_WAIT = 0x0005, - /* 0x0007-0x3fff reserved */ - /* optional */ - SELECT_PORT_XMIT_QUEUE_N = 0x4000, /* 0x0n00 -> VL # */ - SELECT_PORT_XMIT_DATA_VL_N = 0x4001, /* 0x0n00 -> VL # */ - SELECT_PORT_RCV_DATA_VL_N = 0x4002, /* 0x0n00 -> VL # */ - SELECT_PORT_XMIT_PKT_VL_N = 0x4003, /* 0x0n00 -> VL # */ - SELECT_PORT_RCV_PKT_VL_N = 0x4004, /* 0x0n00 -> VL # */ - SELECT_PORT_RCV_ERROR_DETAILS_PORT_LOCAL_PHYSICAL_ERRORS = 0x4005, - SELECT_PORT_RCV_ERROR_DETAILS_PORT_MALFORMED_PACKET_ERRORS = 0x4006, - SELECT_PORT_RCV_ERROR_DETAILS_PORT_BUFFER_OVERRUN_ERRORS = 0x4007, - SELECT_PORT_RCV_ERROR_DETAILS_PORT_DLID_MAPPING_ERRORS = 0x4008, - SELECT_PORT_RCV_ERROR_DETAILS_PORT_VL_MAPPING_ERRORS = 0x4009, - SELECT_PORT_RCV_ERROR_DETAILS_PORT_LOOPING_ERRORS = 0x400A, - SELECT_PORT_XMIT_DiscardDETAILS_PORT_INACTIVE_DISCARDS = 0x400B, - SELECT_PORT_XMIT_DiscardDETAILS_PORT_NEIGHBOR_MTU_DISCARDS = 0x400C, - SELECT_PORT_XMIT_DiscardDETAILS_PORT_SW_LIFETIME_LIMIT_DISCARDS = 0x400D, - SELECT_PORT_XMIT_DiscardDETAILS_PORT_SW_HOQ_LIFETIME_LIMIT_DISCARDS = 0x400E, - SELECT_PORT_OP_RCV_COUNTERS_PORT_OP_RCV_PKTS = 0x400F, - SELECT_PORT_OP_RCV_COUNTERS_PORT_OP_RCV_DATA = 0x4010, - SELECT_PORT_FLOW_CTL_COUNTERS_PORT_XMIT_FLOW_PKTS = 0x4011, - SELECT_PORT_FLOW_CTL_COUNTERS_PORT_RCV_FLOW_PKTS = 0x4012, - SELECT_PORT_VL_OP_PACKETS_PORT_VL_OP_PACKETS_N = 0x4013, /* 0x0n00 -> VL # */ - SELECT_PORT_VL_OP_DATA_PORT_VL_OP_DATA_N = 0x4014, /* 0x0n00 -> VL # */ - SELECT_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS_N = 0x4015, /* 0x0n00 -> VL # */ - SELECT_PORT_VL_XMIT_WAIT_COUNTERS_PORT_VL_XMIT_WAIT_N = 0x4016, /* 0x0n00 -> VL # */ - SELECT_SwPORT_VL_CONGESTION_SW_PORT_VL_CONGESTION = 0x4030, /* 0x0n00 -> VL # */ - /* 0xc000 - 0xffff reserved */ -} SAMPLE_SELECT; - -/* mask bits used in OptionsMask and SamplesOnlyOptionMask */ -typedef union { - uint64 AsUint64; - struct { -#if CPU_BE - uint64 Reserved7:7; - /* 2 fields below are new in IBTA 1.2.1 */ - uint64 PortRcvDataSL:1; - uint64 PortXmitDataSL:1; - uint64 PortVLXmitTimeCong_PortVLXmitTimeCong:1; - uint64 PortXmitConCtrl_PortXmitTimeCong:1; - uint64 PortSLRcvBECN_PortSLPktRcvBECN:1; - uint64 PortSLRcvFECN_PortSLPktRcvFECN:1; - uint64 PortRcvConCtrl_PortPktRcvBECN:1; - uint64 PortRcvConCtrl_PortPktRcvFECN:1; - uint64 SwPortVLCongestion_SWPortVLCongestion:1; - uint64 Reserved6:24; - uint64 PortVLXmitWaitCounters_PortVLXmitWait_n:1; - uint64 PortVLXmitFlowCtlUpdateErrors_PortVLXmitFlowCtlUpdateErrors_n:1; - uint64 PortVLOpData_PortVLOpData_n:1; - uint64 PortVLOpPackets_PortVLOpPackets_n:1; - uint64 PortFlowCtlCounters_PortRcvFlowPkts:1; - uint64 PortFlowCtlCounters_PortXmitFlowPkts:1; - uint64 PortOpRcvCounters_PortOpRcvData:1; - uint64 PortOpRcvCounters_PortOpRcvPkts:1; - uint64 PortXmitDiscardDetails_PortSwHOQLifetimeLimitDiscards:1; - uint64 PortXmitDiscardDetails_PortSwLifetimeLimitDiscards:1; - uint64 PortXmitDiscardDetails_PortNeighborMTUDiscards:1; - uint64 PortXmitDiscardDetails_PortInactiveDiscards:1; - uint64 PortRcvErrorDetails_PortLoopingErrors:1; - uint64 PortRcvErrorDetails_PortVLMappingErrors:1; - uint64 PortRcvErrorDetails_PortDLIDMappingErrors:1; - uint64 PortRcvErrorDetails_PortBufferOverrunErrors:1; - uint64 PortRcvErrorDetails_PortMalformedPacketErrors:1; - uint64 PortRcvErrorDetails_PortLocalPhysicalErrors:1; - uint64 PortRcvPktVL_n:1; - uint64 PortXmitPktVL_n:1; - uint64 PortRcvDataVL_n:1; - uint64 PortXmitDataVL_n:1; - uint64 PortXmitQueue_n:1; - uint16 Reserved5:1; -#else /* CPU_LE */ - uint16 Reserved5:1; - uint64 PortXmitQueue_n:1; - uint64 PortXmitDataVL_n:1; - uint64 PortRcvDataVL_n:1; - uint64 PortXmitPktVL_n:1; - uint64 PortRcvPktVL_n:1; - uint64 PortRcvErrorDetails_PortLocalPhysicalErrors:1; - uint64 PortRcvErrorDetails_PortMalformedPacketErrors:1; - uint64 PortRcvErrorDetails_PortBufferOverrunErrors:1; - uint64 PortRcvErrorDetails_PortDLIDMappingErrors:1; - uint64 PortRcvErrorDetails_PortVLMappingErrors:1; - uint64 PortRcvErrorDetails_PortLoopingErrors:1; - uint64 PortXmitDiscardDetails_PortInactiveDiscards:1; - uint64 PortXmitDiscardDetails_PortNeighborMTUDiscards:1; - uint64 PortXmitDiscardDetails_PortSwLifetimeLimitDiscards:1; - uint64 PortXmitDiscardDetails_PortSwHOQLifetimeLimitDiscards:1; - uint64 PortOpRcvCounters_PortOpRcvPkts:1; - uint64 PortOpRcvCounters_PortOpRcvData:1; - uint64 PortFlowCtlCounters_PortXmitFlowPkts:1; - uint64 PortFlowCtlCounters_PortRcvFlowPkts:1; - uint64 PortVLOpPackets_PortVLOpPackets_n:1; - uint64 PortVLOpData_PortVLOpData_n:1; - uint64 PortVLXmitFlowCtlUpdateErrors_PortVLXmitFlowCtlUpdateErrors_n:1; - uint64 PortVLXmitWaitCounters_PortVLXmitWait_n:1; - uint64 Reserved6:24; - uint64 SwPortVLCongestion_SWPortVLCongestion:1; - uint64 PortRcvConCtrl_PortPktRcvFECN:1; - uint64 PortRcvConCtrl_PortPktRcvBECN:1; - uint64 PortSLRcvFECN_PortSLPktRcvFECN:1; - uint64 PortSLRcvBECN_PortSLPktRcvBECN:1; - uint64 PortXmitConCtrl_PortXmitTimeCong:1; - uint64 PortVLXmitTimeCong_PortVLXmitTimeCong:1; - /* 2 fields below are new in IBTA 1.2.1 */ - uint64 PortXmitDataSL:1; - uint64 PortRcvDataSL:1; - uint64 Reserved7:7; -#endif - } PACK_SUFFIX s; - } PACK_SUFFIX PMA_OptionMask_t; - -typedef struct __PortSamplesControl { - uint8 OpCode; - uint8 PortSelect; /* 0xFF->all ports */ - uint8 Tick; -#if CPU_BE - uint8 Reserved:5; - uint8 CounterWidth:3; -#else /* CPU_LE */ - uint8 CounterWidth:3; - uint8 Reserved:5; -#endif - union { - uint32 AsUint32; - struct { -#if CPU_BE - uint32 Reserved2:2; - uint32 Counter0Mask:3; - uint32 Counter1Mask:3; - uint32 Counter2Mask:3; - uint32 Counter3Mask:3; - uint32 Counter4Mask:3; - uint32 Counter5Mask:3; - uint32 Counter6Mask:3; - uint32 Counter7Mask:3; - uint32 Counter8Mask:3; - uint32 Counter9Mask:3; -#else /* CPU_LE */ - uint32 Counter9Mask:3; - uint32 Counter8Mask:3; - uint32 Counter7Mask:3; - uint32 Counter6Mask:3; - uint32 Counter5Mask:3; - uint32 Counter4Mask:3; - uint32 Counter3Mask:3; - uint32 Counter2Mask:3; - uint32 Counter1Mask:3; - uint32 Counter0Mask:3; - uint32 Reserved2:2; -#endif - } s; - } u1; - union { - uint16 AsUint16; - struct { -#if CPU_BE - uint16 Reserved3:1; - uint16 Counter10Mask:3; - uint16 Counter11Mask:3; - uint16 Counter12Mask:3; - uint16 Counter13Mask:3; - uint16 Counter14Mask:3; -#else /* CPU_LE */ - uint16 Counter14Mask:3; - uint16 Counter13Mask:3; - uint16 Counter12Mask:3; - uint16 Counter11Mask:3; - uint16 Counter10Mask:3; - uint16 Reserved3:1; -#endif - } s; - } u2; - uint8 SampleMechanisms; -#if CPU_BE - uint8 Reserved4:6; - uint8 SampleStatus:2; -#else /* CPU_LE */ - uint8 SampleStatus:2; - uint8 Reserved4:6; -#endif - PMA_OptionMask_t OptionMask; /* which counters are implemented */ - uint64 VendorMask; - uint32 SampleStart; - uint32 SampleInterval; - uint16 Tag; - uint16 CounterSelect[15]; - /* fields below are new in IBTA 1.2.1 */ - uint32 Reserved5; - PMA_OptionMask_t SamplesOnlyOptionMask; /* which counters are supported in samples-only mode */ -} PACK_SUFFIX PortSamplesControl, PORT_SAMPLES_CONTROL; - -typedef struct __PortSamplesResult { - uint16 Tag; - uint8 Reserved; -#if CPU_BE - uint8 Reserved2:6; - uint8 SampleStatus:2; -#else /* CPU_LE */ - uint8 SampleStatus:2; - uint8 Reserved2:6; -#endif - uint32 Counter[15]; -} PACK_SUFFIX PortSamplesResult, PORT_SAMPLES_RESULT; - -typedef struct __PortCounters { - uint8 Reserved; - uint8 PortSelect; /* 0xFF->all ports */ - union PortCountersSelect_u { - uint16 AsUint16; - struct { -#if CPU_BE - uint16 PortRcvPkts:1; - uint16 PortXmitPkts:1; - uint16 PortRcvData:1; - uint16 PortXmitData:1; - uint16 VL15Dropped:1; - uint16 ExcessiveBufferOverrunErrors:1; - uint16 LocalLinkIntegrityErrors:1; - uint16 PortRcvConstraintErrors:1; - uint16 PortXmitConstraintErrors:1; - uint16 PortXmitDiscards:1; - uint16 PortRcvSwitchRelayErrors:1; - uint16 PortRcvRemotePhysicalErrors:1; - uint16 PortRcvErrors:1; - uint16 LinkDownedCounter:1; - uint16 LinkErrorRecoveryCounter:1; - uint16 SymbolErrorCounter:1; -#else /* CPU_LE */ - uint16 SymbolErrorCounter:1; - uint16 LinkErrorRecoveryCounter:1; - uint16 LinkDownedCounter:1; - uint16 PortRcvErrors:1; - uint16 PortRcvRemotePhysicalErrors:1; - uint16 PortRcvSwitchRelayErrors:1; - uint16 PortXmitDiscards:1; - uint16 PortXmitConstraintErrors:1; - uint16 PortRcvConstraintErrors:1; - uint16 LocalLinkIntegrityErrors:1; - uint16 ExcessiveBufferOverrunErrors:1; - uint16 VL15Dropped:1; - uint16 PortXmitData:1; - uint16 PortRcvData:1; - uint16 PortXmitPkts:1; - uint16 PortRcvPkts:1; -#endif - } c; - } CounterSelect; /* which counters to overwrite for Set */ - uint16 SymbolErrorCounter; - uint8 LinkErrorRecoveryCounter; - uint8 LinkDownedCounter; - uint16 PortRcvErrors; - uint16 PortRcvRemotePhysicalErrors; - uint16 PortRcvSwitchRelayErrors; - uint16 PortXmitDiscards; - uint8 PortXmitConstraintErrors; - uint8 PortRcvConstraintErrors; - uint8 Reserved1; -#if CPU_BE - uint8 LocalLinkIntegrityErrors:4; - uint8 ExcessiveBufferOverrunErrors:4; -#else /* CPU_LE */ - uint8 ExcessiveBufferOverrunErrors:4; - uint8 LocalLinkIntegrityErrors:4; -#endif - uint16 Reserved2; - uint16 VL15Dropped; - uint32 PortXmitData; - uint32 PortRcvData; - uint32 PortXmitPkts; - uint32 PortRcvPkts; - uint32 PortXmitWait; /* new in IBTA 1.2.1 */ -} PACK_SUFFIX PortCounters, PORT_COUNTERS; - - - -/* optional attributes */ -typedef struct __PortRcvErrorDetails { - uint8 Reserved; - uint8 PortSelect; /* 0xFF->all ports */ - union PortRcvErrorDetailsSelect_u { - uint16 AsUint16; - struct { -#if CPU_BE - uint64 Reserved1:10; - uint16 PortLoopingErrors:1; - uint16 PortVLMappingErrors:1; - uint16 PortDLIDMappingErrors:1; - uint16 PortBufferOverrunErrors:1; - uint16 PortMalformedPacketErrors:1; - uint16 PortLocalPhysicalErrors:1; -#else /* CPU_LE */ - uint16 PortLocalPhysicalErrors:1; - uint16 PortMalformedPacketErrors:1; - uint16 PortBufferOverrunErrors:1; - uint16 PortDLIDMappingErrors:1; - uint16 PortVLMappingErrors:1; - uint16 PortLoopingErrors:1; - uint64 Reserved1:10; -#endif - } c; - } CounterSelect; /* which counters to overwrite for Set */ - uint16 PortLocalPhysicalErrors; - uint16 PortMalformedPacketErrors; - uint16 PortBufferOverrunErrors; - uint16 PortDLIDMappingErrors; - uint16 PortVLMappingErrors; - uint16 PortLoopingErrors; -} PACK_SUFFIX PortRcvErrorDetails, PORT_RCV_ERROR_DETAILS; - -typedef struct __PortXmitDiscardDetails { - uint8 Reserved; - uint8 PortSelect; /* 0xFF->all ports */ - union PortXmitDiscardDetailsSelect_u { - uint16 AsUint16; - struct { -#if CPU_BE - uint64 Reserved1:12; - uint16 PortSwHOQLifetimeLimitDiscards:1; - uint16 PortSwLifetimeLimitDiscards:1; - uint16 PortNeighborMTUDiscards:1; - uint16 PortInactiveDiscards:1; -#else /* CPU_LE */ - uint16 PortInactiveDiscards:1; - uint16 PortNeighborMTUDiscards:1; - uint16 PortSwLifetimeLimitDiscards:1; - uint16 PortSwHOQLifetimeLimitDiscards:1; - uint64 Reserved1:12; -#endif - } c; - } CounterSelect; /* which counters to overwrite for Set */ - uint16 PortInactiveDiscards; - uint16 PortNeighborMTUDiscards; - uint16 PortSwLifetimeLimitDiscards; - uint16 PortSwHOQLifetimeLimitDiscards; -} PACK_SUFFIX PortXmitDiscardDetails, PORT_XMIT_DISCARD_DETAILS; - -typedef struct __PortOpRcvCounters { - uint8 OpCode; - uint8 PortSelect; /* 0xFF->all ports */ - union PortOpRcvCountersSelect_u { - uint16 AsUint16; - struct { -#if CPU_BE - uint64 Reserved1:14; - uint16 PortOpRcvData:1; - uint16 PortOpRcvPkts:1; -#else /* CPU_LE */ - uint16 PortOpRcvPkts:1; - uint16 PortOpRcvData:1; - uint64 Reserved1:14; -#endif - } c; - } CounterSelect; /* which counters to overwrite for Set */ - uint32 PortOpRcvPkts; - uint32 PortOpRcvData; -} PACK_SUFFIX PortOpRcvCounters, PORT_OP_RCV_COUNTERS; - -typedef struct __PortFlowCtlCounters { - uint8 Reserved; - uint8 PortSelect; /* 0xFF->all ports */ - union PortFlowCtlCountersSelect_u { - uint16 AsUint16; - struct { -#if CPU_BE - uint64 Reserved1:14; - uint16 PortRcvFlowPkts:1; - uint16 PortXmitFlowPkts:1; -#else /* CPU_LE */ - uint16 PortXmitFlowPkts:1; - uint16 PortRcvFlowPkts:1; - uint64 Reserved1:14; -#endif - } c; - } CounterSelect; /* which counters to overwrite for Set */ - uint32 PortXmitFlowPkts; - uint32 PortRcvFlowPkts; -} PACK_SUFFIX PortFlowCtlCounters, PORT_FLOW_CTL_COUNTERS; - -/* This same data structure is used for all per VL 16 bit counters: - * PortVLOpPackets, PortVLXmitWaitCounters, SwPortVLCongestion - */ -typedef struct __PortVLCounters16 { - uint8 OpCode; - uint8 PortSelect; /* 0xFF->all ports */ - union PortVLCounters16Select_u { - uint16 AsUint16; /* 1 << VL */ - struct { -#if CPU_BE - uint16 PortVL15:1; - uint16 PortVL14:1; - uint16 PortVL13:1; - uint16 PortVL12:1; - uint16 PortVL11:1; - uint16 PortVL10:1; - uint16 PortVL9:1; - uint16 PortVL8:1; - uint16 PortVL7:1; - uint16 PortVL6:1; - uint16 PortVL5:1; - uint16 PortVL4:1; - uint16 PortVL3:1; - uint16 PortVL2:1; - uint16 PortVL1:1; - uint16 PortVL0:1; -#else /* CPU_LE */ - uint16 PortVL0:1; - uint16 PortVL1:1; - uint16 PortVL2:1; - uint16 PortVL3:1; - uint16 PortVL4:1; - uint16 PortVL5:1; - uint16 PortVL6:1; - uint16 PortVL7:1; - uint16 PortVL8:1; - uint16 PortVL9:1; - uint16 PortVL10:1; - uint16 PortVL11:1; - uint16 PortVL12:1; - uint16 PortVL13:1; - uint16 PortVL14:1; - uint16 PortVL15:1; -#endif - } c; - } CounterSelect; /* which counters to overwrite for Set */ - uint16 PortVLCounter[16]; -} PACK_SUFFIX PortVLCounters16, PORT_VL_COUNTERS16, - PortVLOpPackets, PORT_VL_OP_PACKETS, - PortVLXmitWaitCounters, PORT_VL_XMIT_WAIT_COUNTERS, - SwPortVLCongestion, SW_PORT_VL_CONGESTION; - -/* This same data structure is used for all per VL 32 bit counters: - * PortVLOpData - */ -typedef struct __PortVLCounters32 { - uint8 OpCode; - uint8 PortSelect; /* 0xFF->all ports */ - union PortVLCounters32Select_u { - uint16 AsUint16; /* 1 << VL */ - struct { -#if CPU_BE - uint16 PortVL15:1; - uint16 PortVL14:1; - uint16 PortVL13:1; - uint16 PortVL12:1; - uint16 PortVL11:1; - uint16 PortVL10:1; - uint16 PortVL9:1; - uint16 PortVL8:1; - uint16 PortVL7:1; - uint16 PortVL6:1; - uint16 PortVL5:1; - uint16 PortVL4:1; - uint16 PortVL3:1; - uint16 PortVL2:1; - uint16 PortVL1:1; - uint16 PortVL0:1; -#else /* CPU_LE */ - uint16 PortVL0:1; - uint16 PortVL1:1; - uint16 PortVL2:1; - uint16 PortVL3:1; - uint16 PortVL4:1; - uint16 PortVL5:1; - uint16 PortVL6:1; - uint16 PortVL7:1; - uint16 PortVL8:1; - uint16 PortVL9:1; - uint16 PortVL10:1; - uint16 PortVL11:1; - uint16 PortVL12:1; - uint16 PortVL13:1; - uint16 PortVL14:1; - uint16 PortVL15:1; -#endif - } c; - } CounterSelect; /* which counters to overwrite for Set */ - uint32 PortVLCounter[16]; -} PACK_SUFFIX PortVLCounters32, PORT_VL_COUNTERS32, - PortVLOpData, PORT_VL_OP_DATA; - -/* This same data structure is used for all per VL 2 bit counters: - * PortVLXmitFlowCtlUpdateErrors - */ -typedef struct __PortVLCounters2 { - uint8 Reserved; - uint8 PortSelect; /* 0xFF->all ports */ - union PortVLCounters2Select_u { - uint16 AsUint16; /* 1 << VL */ - struct { -#if CPU_BE - uint16 PortVL15:1; - uint16 PortVL14:1; - uint16 PortVL13:1; - uint16 PortVL12:1; - uint16 PortVL11:1; - uint16 PortVL10:1; - uint16 PortVL9:1; - uint16 PortVL8:1; - uint16 PortVL7:1; - uint16 PortVL6:1; - uint16 PortVL5:1; - uint16 PortVL4:1; - uint16 PortVL3:1; - uint16 PortVL2:1; - uint16 PortVL1:1; - uint16 PortVL0:1; -#else /* CPU_LE */ - uint16 PortVL0:1; - uint16 PortVL1:1; - uint16 PortVL2:1; - uint16 PortVL3:1; - uint16 PortVL4:1; - uint16 PortVL5:1; - uint16 PortVL6:1; - uint16 PortVL7:1; - uint16 PortVL8:1; - uint16 PortVL9:1; - uint16 PortVL10:1; - uint16 PortVL11:1; - uint16 PortVL12:1; - uint16 PortVL13:1; - uint16 PortVL14:1; - uint16 PortVL15:1; -#endif - } c; - } CounterSelect; /* which counters to overwrite for Set */ - IB_BITFIELD4( uint8, - PortVLCounter0, - PortVLCounter1, - PortVLCounter2, - PortVLCounter3) - IB_BITFIELD4( uint8, - PortVLCounter4, - PortVLCounter5, - PortVLCounter6, - PortVLCounter7) - IB_BITFIELD4( uint8, - PortVLCounter8, - PortVLCounter9, - PortVLCounter10, - PortVLCounter11) - IB_BITFIELD4( uint8, - PortVLCounter12, - PortVLCounter13, - PortVLCounter14, - PortVLCounter15) -} PACK_SUFFIX PortVLCounters2, PORT_VL_COUNTERS2, - PortVLXmitFlowCtlUpdateErrors, PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS; - -/* values for ExtendedWidth field */ -#define PORT_SAMPLES_RESULT_EXTENDED_WIDTH_48 0x1 -#define PORT_SAMPLES_RESULT_EXTENDED_WIDTH_64 0x2 - -typedef struct __PortSamplesResultExtended { - uint16 Tag; - uint8 Reserved; -#if CPU_BE - uint8 Reserved2:6; - uint8 SampleStatus:2; -#else /* CPU_LE */ - uint8 SampleStatus:2; - uint8 Reserved2:6; -#endif - IB_BITFIELD2( uint32, - ExtendedWidth:2, - Reserved3:30) - uint64 Counter[15]; -} PACK_SUFFIX PortSamplesResultExtended, PORT_SAMPLES_RESULT_EXTENDED; - -typedef struct __PortCountersExtended { - uint8 Reserved; - uint8 PortSelect; /* 0xFF->all ports */ - union PortCountersExtendedSelect_u { - uint16 AsUint16; - struct { -#if CPU_BE - uint16 Reserved:8; - uint16 PortMulticastRcvPkts:1; - uint16 PortMulticastXmitPkts:1; - uint16 PortUnicastRcvPkts:1; - uint16 PortUnicastXmitPkts:1; - uint16 PortRcvPkts:1; - uint16 PortXmitPkts:1; - uint16 PortRcvData:1; - uint16 PortXmitData:1; -#else /* CPU_LE */ - uint16 PortXmitData:1; - uint16 PortRcvData:1; - uint16 PortXmitPkts:1; - uint16 PortRcvPkts:1; - uint16 PortUnicastXmitPkts:1; - uint16 PortUnicastRcvPkts:1; - uint16 PortMulticastXmitPkts:1; - uint16 PortMulticastRcvPkts:1; - uint16 Reserved:8; -#endif - } c; - } CounterSelect; /* which counters to overwrite for Set */ - uint32 Reserved2; - uint64 PortXmitData; - uint64 PortRcvData; - uint64 PortXmitPkts; - uint64 PortRcvPkts; - uint64 PortUnicastXmitPkts; - uint64 PortUnicastRcvPkts; - uint64 PortMulticastXmitPkts; - uint64 PortMulticastRcvPkts; -} PACK_SUFFIX PortCountersExtended, PORT_COUNTERS_EXTENDED; - -// Bits for CC field in Attribute Modifier -// These indicated which counters should be cleared in a Set -// For devices with VendorPortCounters2 capability, the Set can -// contain thresholds for each counter and only those whose -// CC field is selected and have a counter value > the threshold -// will be cleared. A threshold of 0 will clear any non-zero counter -// A threshold of 0xffff for a 16 bit counter will never clear it. -// Values inbetween only clear when counter is > threshold. -// In all cases, the GetResp reports the counter value BEFORE any clear. -#define PM_VENDOR_PORT_COUNTERS_ALL_ERROR_COUNTERS 0x01000000U -#define PM_VENDOR_PORT_COUNTERS_ALL_DATA_COUNTERS 0x02000000U -#define PM_VENDOR_PORT_COUNTERS_TOTAL_CONGESTION 0x04000000U -#define PM_VENDOR_PORT_COUNTERS_ADAPTIVE_ROUTING 0x08000000U -#if 0 -#define PM_VENDOR_PORT_COUNTERS_VL_DATA_COUNTERS 0x10000000U -#define PM_VENDOR_PORT_COUNTERS_VL_CONGESTION 0x20000000U -#define PM_VENDOR_PORT_COUNTERS_ALL 0x3f000000U -#else -#define PM_VENDOR_PORT_COUNTERS_ALL 0x0f000000U -#endif -// upper 2 bits reserved -// lower 8 bits are port selector - -// PortCheckRate upper 3 bits indicate the nature of the value -#define PM_VENDOR_PORT_COUNTERS_RATE_VALUE_MASK 0x1fff -#define PM_VENDOR_PORT_COUNTERS_RATE_TYPE_MASK 0xe000 -#define PM_VENDOR_PORT_COUNTERS_RATE_TYPE_CONG 0x0000 // Cong checks/sec -#define PM_VENDOR_PORT_COUNTERS_RATE_TYPE_PICO_TICK 0xe000 // XmitWait Tick ps - -// Unlike other PMA packets this starts at byte 24 immediately after -// the MAD_COMMON header -typedef struct __VendorPortCounters { - uint16 Reserved1; - uint16 PortCheckRate; - uint16 SymbolErrorCounter; - uint8 LinkErrorRecoveryCounter; - uint8 LinkDownedCounter; - uint16 PortRcvErrors; - uint16 PortRcvRemotePhysicalErrors; - uint16 PortRcvSwitchRelayErrors; - uint16 PortXmitDiscards; - uint8 PortXmitConstraintErrors; - uint8 PortRcvConstraintErrors; - uint8 Reserved2; - IB_BITFIELD2( uint8, - LocalLinkIntegrityErrors:4, - ExcessiveBufferOverrunErrors:4) - uint16 Reserved3; - uint16 VL15Dropped; - uint64 PortXmitData; - uint64 PortRcvData; - uint64 PortXmitPkts; - uint64 PortRcvPkts; - uint64 PortXmitCongestion; // TrueScale SW, Num of Xmit congestion events - uint64 PortAdaptiveRouting;// TrueScale SW adaptive routing events -#if 0 - struct { - uint32 PortRcvDataMB; // VL RcvData in units of MBytes - uint32 PortRcvKPkts; // VL RcvPkts in units of KPackets - uint32 PortXmitDataMB; // VL XmitData in units of MBytes - uint32 PortXmitKPkts; // VL XmitPkts in units of KPackets - } PACK_SUFFIX VL[8]; - uint32 VLPortXmitCongestion[8]; // per VL -#endif -} PACK_SUFFIX VendorPortCounters, VENDOR_PORT_COUNTERS; - - -/* End of packed data structures */ -#include "iba/public/ipackoff.h" - - -/* Byte Swap macros - convert between host and network byte order */ - -static __inline void -BSWAP_PM_PORT_SAMPLES_CONTROL (PORT_SAMPLES_CONTROL *pPortSamplesControl) -{ -#if CPU_LE - int i; - - pPortSamplesControl->u1.AsUint32 = ntoh32(pPortSamplesControl->u1.AsUint32); - pPortSamplesControl->u2.AsUint16 = ntoh16(pPortSamplesControl->u2.AsUint16); - pPortSamplesControl->OptionMask.AsUint64 = ntoh64(pPortSamplesControl->OptionMask.AsUint64); - pPortSamplesControl->VendorMask = ntoh64(pPortSamplesControl->VendorMask); - pPortSamplesControl->SampleStart = ntoh32(pPortSamplesControl->SampleStart); - pPortSamplesControl->SampleInterval = ntoh32(pPortSamplesControl->SampleInterval); - pPortSamplesControl->Tag = ntoh16(pPortSamplesControl->Tag); - for (i=0; i<15; ++i) - { - pPortSamplesControl->CounterSelect[i] = ntoh16(pPortSamplesControl->CounterSelect[i]); - } - pPortSamplesControl->SamplesOnlyOptionMask.AsUint64 = ntoh64(pPortSamplesControl->SamplesOnlyOptionMask.AsUint64); -#endif -} - -static __inline void -BSWAP_PM_PORT_SAMPLES_RESULT (PORT_SAMPLES_RESULT *pPortSamplesResult) -{ -#if CPU_LE - int i; - - pPortSamplesResult->Tag = ntoh16(pPortSamplesResult->Tag); - for (i=0; i<15; ++i) - { - pPortSamplesResult->Counter[i] = ntoh32(pPortSamplesResult->Counter[i]); - } -#endif -} - -static __inline void -BSWAP_PM_PORT_COUNTERS (PORT_COUNTERS *pPortCounters) -{ -#if CPU_LE - pPortCounters->CounterSelect.AsUint16 = ntoh16(pPortCounters->CounterSelect.AsUint16); - pPortCounters->SymbolErrorCounter = ntoh16(pPortCounters->SymbolErrorCounter); - pPortCounters->PortRcvErrors = ntoh16(pPortCounters->PortRcvErrors); - pPortCounters->PortRcvRemotePhysicalErrors = ntoh16(pPortCounters->PortRcvRemotePhysicalErrors); - pPortCounters->PortRcvSwitchRelayErrors = ntoh16(pPortCounters->PortRcvSwitchRelayErrors); - pPortCounters->PortXmitDiscards = ntoh16(pPortCounters->PortXmitDiscards); - pPortCounters->VL15Dropped = ntoh16(pPortCounters->VL15Dropped); - pPortCounters->PortXmitData = ntoh32(pPortCounters->PortXmitData); - pPortCounters->PortRcvData = ntoh32(pPortCounters->PortRcvData); - pPortCounters->PortXmitPkts = ntoh32(pPortCounters->PortXmitPkts); - pPortCounters->PortRcvPkts = ntoh32(pPortCounters->PortRcvPkts); - pPortCounters->PortXmitWait = ntoh32(pPortCounters->PortXmitWait); -#endif -} - -static __inline void -BSWAP_PM_PORT_RCV_ERROR_DETAILS (PORT_RCV_ERROR_DETAILS *pPortRcvErrorDetails) -{ -#if CPU_LE - pPortRcvErrorDetails->CounterSelect.AsUint16 = ntoh16(pPortRcvErrorDetails->CounterSelect.AsUint16); - pPortRcvErrorDetails->PortLocalPhysicalErrors = ntoh16(pPortRcvErrorDetails->PortLocalPhysicalErrors); - pPortRcvErrorDetails->PortMalformedPacketErrors = ntoh16(pPortRcvErrorDetails->PortMalformedPacketErrors); - pPortRcvErrorDetails->PortBufferOverrunErrors = ntoh16(pPortRcvErrorDetails->PortBufferOverrunErrors); - pPortRcvErrorDetails->PortDLIDMappingErrors = ntoh16(pPortRcvErrorDetails->PortDLIDMappingErrors); - pPortRcvErrorDetails->PortVLMappingErrors = ntoh16(pPortRcvErrorDetails->PortVLMappingErrors); - pPortRcvErrorDetails->PortLoopingErrors = ntoh16(pPortRcvErrorDetails->PortLoopingErrors); -#endif -} - -static __inline void -BSWAP_PM_PORT_XMIT_DISCARD_DETAILS(PORT_XMIT_DISCARD_DETAILS *pPortXmitDiscardDetails) -{ -#if CPU_LE - pPortXmitDiscardDetails->CounterSelect.AsUint16 = ntoh16(pPortXmitDiscardDetails->CounterSelect.AsUint16); - pPortXmitDiscardDetails->PortInactiveDiscards = ntoh16(pPortXmitDiscardDetails->PortInactiveDiscards); - pPortXmitDiscardDetails->PortNeighborMTUDiscards = ntoh16(pPortXmitDiscardDetails->PortNeighborMTUDiscards); - pPortXmitDiscardDetails->PortSwLifetimeLimitDiscards = ntoh16(pPortXmitDiscardDetails->PortSwLifetimeLimitDiscards); - pPortXmitDiscardDetails->PortSwHOQLifetimeLimitDiscards = ntoh16(pPortXmitDiscardDetails->PortSwHOQLifetimeLimitDiscards); -#endif -} - -static __inline void -BSWAP_PM_PORT_OP_RCV_COUNTERS(PORT_OP_RCV_COUNTERS *pPortOpRcvCounters) -{ -#if CPU_LE - pPortOpRcvCounters->CounterSelect.AsUint16 = ntoh16(pPortOpRcvCounters->CounterSelect.AsUint16); - pPortOpRcvCounters->PortOpRcvPkts = ntoh32(pPortOpRcvCounters->PortOpRcvPkts); - pPortOpRcvCounters->PortOpRcvData = ntoh32(pPortOpRcvCounters->PortOpRcvData); -#endif -} - -static __inline void -BSWAP_PM_PORT_FLOW_CTL_COUNTERS(PORT_FLOW_CTL_COUNTERS *pPortFlowCtlCounters) -{ -#if CPU_LE - pPortFlowCtlCounters->CounterSelect.AsUint16 = ntoh16(pPortFlowCtlCounters->CounterSelect.AsUint16); - pPortFlowCtlCounters->PortXmitFlowPkts = ntoh32(pPortFlowCtlCounters->PortXmitFlowPkts); - pPortFlowCtlCounters->PortRcvFlowPkts = ntoh32(pPortFlowCtlCounters->PortRcvFlowPkts); -#endif -} - -static __inline void -BSWAP_PM_PORT_VL_COUNTERS16 (struct __PortVLCounters16 *pPortVLCounters) -{ -#if CPU_LE - int i; - - pPortVLCounters->CounterSelect.AsUint16 = ntoh16(pPortVLCounters->CounterSelect.AsUint16); - for (i=0; i<15; ++i) { - pPortVLCounters->PortVLCounter[i] = ntoh16(pPortVLCounters->PortVLCounter[i]); - } -#endif -} - -static __inline void -BSWAP_PM_PORT_VL_OP_PACKETS (PORT_VL_OP_PACKETS *pPortVLCounters) -{ - BSWAP_PM_PORT_VL_COUNTERS16 (pPortVLCounters); -} - -static __inline void -BSWAP_PM_PORT_VL_XMIT_WAIT_COUNTERS (PORT_VL_XMIT_WAIT_COUNTERS *pPortVLCounters) -{ - BSWAP_PM_PORT_VL_COUNTERS16 (pPortVLCounters); -} - -static __inline void -BSWAP_PM_SW_PORT_VL_CONGESTION (SW_PORT_VL_CONGESTION *pPortVLCounters) -{ - BSWAP_PM_PORT_VL_COUNTERS16 (pPortVLCounters); -} - -static __inline void -BSWAP_PM_PORT_VL_COUNTERS32 (struct __PortVLCounters32 *pPortVLCounters) -{ -#if CPU_LE - int i; - - pPortVLCounters->CounterSelect.AsUint16 = ntoh16(pPortVLCounters->CounterSelect.AsUint16); - for (i=0; i<15; ++i) { - pPortVLCounters->PortVLCounter[i] = ntoh32(pPortVLCounters->PortVLCounter[i]); - } -#endif -} - -static __inline void -BSWAP_PM_PORT_VL_OP_DATA (PORT_VL_OP_DATA *pPortVLCounters) -{ - BSWAP_PM_PORT_VL_COUNTERS32 (pPortVLCounters); -} - -static __inline void -BSWAP_PM_PORT_VL_COUNTERS2 (struct __PortVLCounters2 *pPortVLCounters) -{ -#if CPU_LE - pPortVLCounters->CounterSelect.AsUint16 = ntoh16(pPortVLCounters->CounterSelect.AsUint16); -#endif -} - -static __inline void -BSWAP_PM_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS (PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS *pPortVLCounters) -{ - BSWAP_PM_PORT_VL_COUNTERS2 (pPortVLCounters); -} - -static __inline void -BSWAP_PM_PORT_SAMPLES_RESULT_EXTENDED (PORT_SAMPLES_RESULT_EXTENDED *pPortSamplesResult) -{ -#if CPU_LE - int i; - - pPortSamplesResult->Tag = ntoh16(pPortSamplesResult->Tag); - for (i=0; i<15; ++i) - { - pPortSamplesResult->Counter[i] = ntoh64(pPortSamplesResult->Counter[i]); - } -#endif -} - -static __inline void -BSWAP_PM_PORT_COUNTERS_EXTENDED (PORT_COUNTERS_EXTENDED *pPortCounters) -{ -#if CPU_LE - pPortCounters->CounterSelect.AsUint16 = ntoh16(pPortCounters->CounterSelect.AsUint16); - pPortCounters->PortXmitData = ntoh64(pPortCounters->PortXmitData); - pPortCounters->PortRcvData = ntoh64(pPortCounters->PortRcvData); - pPortCounters->PortXmitPkts = ntoh64(pPortCounters->PortXmitPkts); - pPortCounters->PortRcvPkts = ntoh64(pPortCounters->PortRcvPkts); - pPortCounters->PortUnicastXmitPkts = ntoh64(pPortCounters->PortUnicastXmitPkts); - pPortCounters->PortUnicastRcvPkts = ntoh64(pPortCounters->PortUnicastRcvPkts); - pPortCounters->PortMulticastXmitPkts = ntoh64(pPortCounters->PortMulticastXmitPkts); - pPortCounters->PortMulticastRcvPkts = ntoh64(pPortCounters->PortMulticastRcvPkts); -#endif -} - -static __inline void -BSWAP_PM_VENDOR_PORT_COUNTERS (VENDOR_PORT_COUNTERS *pPortCounters) -{ -#if CPU_LE - //int i; - - pPortCounters->PortCheckRate = ntoh16(pPortCounters->PortCheckRate); - pPortCounters->SymbolErrorCounter = ntoh16(pPortCounters->SymbolErrorCounter); - pPortCounters->PortRcvErrors = ntoh16(pPortCounters->PortRcvErrors); - pPortCounters->PortRcvRemotePhysicalErrors = ntoh16(pPortCounters->PortRcvRemotePhysicalErrors); - pPortCounters->PortRcvSwitchRelayErrors = ntoh16(pPortCounters->PortRcvSwitchRelayErrors); - pPortCounters->PortXmitDiscards = ntoh16(pPortCounters->PortXmitDiscards); - pPortCounters->VL15Dropped = ntoh16(pPortCounters->VL15Dropped); - pPortCounters->PortXmitData = ntoh64(pPortCounters->PortXmitData); - pPortCounters->PortRcvData = ntoh64(pPortCounters->PortRcvData); - pPortCounters->PortXmitPkts = ntoh64(pPortCounters->PortXmitPkts); - pPortCounters->PortRcvPkts = ntoh64(pPortCounters->PortRcvPkts); - pPortCounters->PortXmitCongestion = ntoh64(pPortCounters->PortXmitCongestion); - pPortCounters->PortAdaptiveRouting = ntoh64(pPortCounters->PortAdaptiveRouting); -#if 0 - for (i=0; i<8; ++i) { - pPortCounters->VL[i].PortRcvDataMB = ntoh32(pPortCounters->VL[i].PortRcvDataMB); - pPortCounters->VL[i].PortRcvKPkts = ntoh32(pPortCounters->VL[i].PortRcvKPkts); - pPortCounters->VL[i].PortXmitDataMB = ntoh32(pPortCounters->VL[i].PortXmitDataMB); - pPortCounters->VL[i].PortXmitKPkts = ntoh32(pPortCounters->VL[i].PortXmitKPkts); - pPortCounters->VLPortXmitCongestion[i] = ntoh32(pPortCounters->VLPortXmitCongestion[i]); - } -#endif -#endif -} - -#ifdef __cplusplus -} -#endif - -#endif /* _IBA_IB_PM_H_ */ diff --git a/IbAccess/Common/Inc/ib_sa_records.h b/IbAccess/Common/Inc/ib_sa_records.h index 78702d3a..88dbe2ed 100644 --- a/IbAccess/Common/Inc/ib_sa_records.h +++ b/IbAccess/Common/Inc/ib_sa_records.h @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT3 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-17, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -29,23 +29,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* [ICS VERSION STRING: unknown] */ -#if defined(CHECK_HEADERS) - -#ifndef __STL_SA_H__ -#warning FIX ME!!! Your includes should use the stl_sa.h header and not the ib_sa_records.h header for STL builds -#endif - -#endif - #ifndef _IBA_IB_SA_RECORDS_H_ #define _IBA_IB_SA_RECORDS_H_ /* IB Subnet Adminstration records and methods */ #include "iba/public/datatypes.h" /* Portable datatypes */ -#include "iba/stl_types.h" /* IBA specific datatypes */ -#include "iba/stl_sm.h" -#include "iba/stl_helper.h" +#include "iba/stl_sm_types.h" #ifndef IB_STACK_OPENIB #include "iba/vpi.h" #endif @@ -133,7 +123,7 @@ typedef enum { * SA records themselves */ - + /* -------------------------------------------------------------------------- * Path Record - describes path between 2 end nodes in the fabric */ @@ -256,7 +246,7 @@ typedef struct _IB_PATH_RECORD { uint8 Reserved2 [6]; } PACK_SUFFIX IB_PATH_RECORD; - + /* -------------------------------------------------------------------------- * Node Record - describes a port on a node in the fabric */ @@ -297,7 +287,7 @@ typedef struct _IB_NODE_RECORD { NODE_DESCRIPTION NodeDescData; } PACK_SUFFIX IB_NODE_RECORD; - + /* -------------------------------------------------------------------------- * PortInfo Record - detailed description of a port on a node in the fabric */ @@ -352,243 +342,6 @@ typedef struct _IB_PORTINFO_RECORD { PORT_INFO PortInfoData; } PACK_SUFFIX IB_PORTINFO_RECORD; - -/* -------------------------------------------------------------------------- - * Switch Info Record - information about a switch in the fabric - */ - -/* ComponentMask bits */ -#define IB_SWITCHINFO_RECORD_COMP_LID 0x00000001 - /* reserved field 0x00000002*/ - /* switch info fields */ -#define IB_SWITCHINFO_RECORD_COMP_LINEARFDBCAP 0x00000004 -#define IB_SWITCHINFO_RECORD_COMP_RANDOMFDBCAP 0x00000008 -#define IB_SWITCHINFO_RECORD_COMP_MULTICASTFDBCAP 0x00000010 -#define IB_SWITCHINFO_RECORD_COMP_LINEARFDBTOP 0x00000020 -#define IB_SWITCHINFO_RECORD_COMP_DEFAULTPORT 0x00000040 -#define IB_SWITCHINFO_RECORD_COMP_DEFAULTMULTICASTPRIMARYPORT 0x00000080 -#define IB_SWITCHINFO_RECORD_COMP_DEFAULTMULTICASTNOTPRIMARYPORT 0x00000100 -#define IB_SWITCHINFO_RECORD_COMP_LIFETIMEVALUE 0x00000200 -#define IB_SWITCHINFO_RECORD_COMP_PORTSTATECHANGE 0x00000400 - /* reserved field 0x00000800*/ -#define IB_SWITCHINFO_RECORD_COMP_LIDSPERPORT 0x00001000 -#define IB_SWITCHINFO_RECORD_COMP_PARTITIONENFORCEMENTCAP 0x00002000 -#define IB_SWITCHINFO_RECORD_COMP_INBOUNDENFORCEMENTCAP 0x00004000 -#define IB_SWITCHINFO_RECORD_COMP_OUTBOUNDENFORCEMENTCAP 0x00008000 -#define IB_SWITCHINFO_RECORD_COMP_FILTERRAWINBOUNDCAP 0x00010000 -#define IB_SWITCHINFO_RECORD_COMP_FILTERRAWOUTBOUNDCAP 0x00020000 -#define IB_SWITCHINFO_RECORD_COMP_ENHANCEDPORT0 0x00040000 - /* reserved field 0x00080000*/ - -typedef struct _IB_SWITCHINFO_RECORD { - union { - uint32 AsReg32; - struct { -#if CPU_BE - uint32 LID:16; - uint32 Reserved:16; -#else - uint32 Reserved:16; - uint32 LID:16; -#endif - } PACK_SUFFIX s; - } RID; - SWITCH_INFO SwitchInfoData; -} PACK_SUFFIX IB_SWITCHINFO_RECORD; - - -/* -------------------------------------------------------------------------- - * Linear Forwarding Table Record - linear forwarding table for a switch in the fabric - */ - -/* ComponentMask bits */ -#define IB_LINEARFDB_RECORD_COMP_LID 0x00000001 -#define IB_LINEARFDB_RECORD_COMP_BLOCKNUM 0x00000002 - /* reserved field 0x00000004 */ - /* linear forwarding table fields */ - /* Note insufficient bits in component mask to select */ - /* all 64 entries in record */ - -typedef struct _IB_LINEAR_FDB_RECORD { - union { - uint32 AsReg32; - struct { -#if CPU_BE - uint32 LID:16; - uint32 BlockNum:16; -#else - uint32 BlockNum:16; - uint32 LID:16; -#endif - } PACK_SUFFIX s; - } RID; - uint32 Reserved; - FORWARDING_TABLE LinearFdbData; -} PACK_SUFFIX IB_LINEAR_FDB_RECORD; - - -/* -------------------------------------------------------------------------- - * Random Forwarding Table Record - random forwarding table for a switch in the fabric - */ - -/* ComponentMask bits */ -#define IB_RANDOMFDB_RECORD_COMP_LID 0x00000001 -#define IB_RANDOMFDB_RECORD_COMP_BLOCKNUM 0x00000002 - /* reserved field 0x00000004 */ - /* random forwarding table fields */ - /* Note insufficient bits in component mask to select */ - /* all 5 fields in all 16 entries in record */ - -typedef struct _IB_RANDOM_FDB_RECORD { - union { - uint32 AsReg32; - struct { -#if CPU_BE - uint32 LID:16; - uint32 BlockNum:16; -#else - uint32 BlockNum:16; - uint32 LID:16; -#endif - } PACK_SUFFIX s; - } RID; - uint32 Reserved; - FORWARDING_TABLE RandomFdbData; -} PACK_SUFFIX IB_RANDOM_FDB_RECORD; - - -/* -------------------------------------------------------------------------- - * Multicast Forwarding Table Record - multicast forwarding table for a switch in the fabric - */ - -/* ComponentMask bits */ -#define IB_MCASTFDB_RECORD_COMP_LID 0x00000001 -#define IB_MCASTFDB_RECORD_COMP_POSITION 0x00000002 - /* reserved field 0x00000004 */ -#define IB_MCASTFDB_RECORD_COMP_BLOCKNUM 0x00000008 - /* reserved field 0x00000010 */ - /* multicast forwarding table fields */ - /* limited value to select on these, so omitted defines */ - -typedef struct _IB_MCAST_FDB_RECORD { - union { - uint32 AsReg32; - struct { -#if CPU_BE - uint32 LID:16; - uint32 Position:4; - uint32 Reserved0:3; - uint32 BlockNum:9; -#else - uint32 BlockNum:9; - uint32 Reserved0:3; - uint32 Position:4; - uint32 LID:16; -#endif - } PACK_SUFFIX s; - } RID; - uint32 Reserved; - FORWARDING_TABLE MCastFdbData; -} PACK_SUFFIX IB_MCAST_FDB_RECORD; - - -/* -------------------------------------------------------------------------- - * VL Arbitration Table Record - VL priority controls for a port on a node in the fabric - */ - -/* ComponentMask bits */ -#define IB_VLARBTABLE_RECORD_COMP_LID 0x00000001 -#define IB_VLARBTABLE_RECORD_COMP_OUTPUTPORTNUM 0x00000002 -#define IB_VLARBTABLE_RECORD_COMP_BLOCKNUM 0x00000004 - /* reserved field 0x00000008 */ - /* Note insufficient bits in component mask to select */ - /* all 3 fields in all 32 entries in record */ - -typedef struct _IB_VLARBTABLE_RECORD { - union { - uint32 AsReg32; - struct { -#if CPU_BE - uint32 LID:16; - uint32 OutputPortNum:8; - uint32 BlockNum:8; -#else - uint32 BlockNum:8; - uint32 OutputPortNum:8; - uint32 LID:16; -#endif - } PACK_SUFFIX s; - } RID; - uint32 Reserved; - VLARBTABLE VLArbData; /* VLArbitration attribute */ -} PACK_SUFFIX IB_VLARBTABLE_RECORD; - - -/* -------------------------------------------------------------------------- - * SM Info Record - basic information about an SM in the fabric - */ - -/* ComponentMask bits */ -#define IB_SMINFO_RECORD_COMP_LID 0x00000001 - /* reserved field 0x00000002 */ - /* SM Info fields */ -#define IB_SMINFO_RECORD_COMP_GUID 0x00000004 -#define IB_SMINFO_RECORD_COMP_SMKEY 0x00000008 -#define IB_SMINFO_RECORD_COMP_ACTCOUNT 0x00000010 -#define IB_SMINFO_RECORD_COMP_PRIORITY 0x00000020 -#define IB_SMINFO_RECORD_COMP_SMSTATE 0x00000040 - -typedef struct _IB_SMINFO_RECORD { - union { - uint32 AsReg32; - struct { -#if CPU_BE - uint32 LID:16; - uint32 Reserved:16; -#else - uint32 Reserved:16; - uint32 LID:16; -#endif - } PACK_SUFFIX s; - } RID; - SM_INFO SMInfoData; /* SMInfo attribute */ -} PACK_SUFFIX IB_SMINFO_RECORD; - - -/* -------------------------------------------------------------------------- - * P_Key Table Record - P-Key configuration for a port on a node in the fabric - */ - -/* ComponentMask bits */ -#define IB_PKEYTABLE_RECORD_COMP_LID 0x00000001 -#define IB_PKEYTABLE_RECORD_COMP_BLOCKNUM 0x00000002 -#define IB_PKEYTABLE_RECORD_COMP_PORTNUM 0x00000004 - /* reserved field 0x00000008 */ - /* P Key Table fields */ - /* limited value to select on these, so omitted defines */ - -typedef struct _IB_P_KEY_TABLE_RECORD { - union { - struct { - uint32 AsReg32; - uint8 Byte; - } PACK_SUFFIX s2; - struct { -#if CPU_BE - uint32 LID:16; - uint32 BlockNum:16; -#else - uint32 BlockNum:16; - uint32 LID:16; -#endif - uint8 PortNum; - } PACK_SUFFIX s; - } PACK_SUFFIX RID; - uint8 Reserved[3]; - PARTITION_TABLE PKeyTblData; /* PartitionTable for this port */ -} PACK_SUFFIX IB_P_KEY_TABLE_RECORD; - - /* -------------------------------------------------------------------------- * Inform Info (event subscription) Record - SA events which have been subscribed to */ @@ -622,27 +375,6 @@ typedef struct _IB_INFORM_INFO_RECORD { /* for this port */ } PACK_SUFFIX IB_INFORM_INFO_RECORD; - -/* -------------------------------------------------------------------------- - * Link Record - details about a link in the fabric - */ - -/* ComponentMask bits */ -#define IB_LINK_RECORD_COMP_FROMLID 0x00000001 -#define IB_LINK_RECORD_COMP_FROMPORT 0x00000002 -#define IB_LINK_RECORD_COMP_TOPORT 0x00000004 -#define IB_LINK_RECORD_COMP_TOLID 0x00000008 - -typedef struct _IB_LINK_RECORD { - struct { - uint16 FromLID; /* From this LID */ - uint8 FromPort; /* From port number */ - } PACK_SUFFIX RID; - uint8 ToPort; /* To port number */ - uint16 ToLID; /* To this LID */ -} PACK_SUFFIX IB_LINK_RECORD; - - /* -------------------------------------------------------------------------- * Service Record - services provided by nodes in the fabric */ @@ -709,7 +441,6 @@ typedef struct _IB_SERVICE_RECORD { uint64 ServiceData64[2]; } PACK_SUFFIX IB_SERVICE_RECORD; - /* -------------------------------------------------------------------------- * Service Association Record - map between service keys and names */ @@ -723,7 +454,7 @@ typedef struct _IB_SERVICEASSOCIATION_RECORD { uint8 ServiceName[16]; /* UTF8 null terminated */ } PACK_SUFFIX IB_SERVICEASSOCIATION_RECORD; - + /* -------------------------------------------------------------------------- * Multicast Member Record - members in a multicast group */ @@ -826,9 +557,9 @@ typedef struct _IB_MCMEMBER_RECORD { uint8 Reserved3[2]; /* TBD spec has odd size here */ } PACK_SUFFIX IB_MCMEMBER_RECORD; - - + + /* -------------------------------------------------------------------------- * Trace Record - trace a path through the fabric */ @@ -860,7 +591,7 @@ typedef struct _IB_TRACE_RECORD { uint8 ExitPort; } PACK_SUFFIX IB_TRACE_RECORD; - + /* -------------------------------------------------------------------------- * Multipath Record - a set of paths between nodes in the fabric */ @@ -982,601 +713,8 @@ typedef struct _IB_MULTIPATH_RECORD { /* followed by DGIDCount dest GIDs */ } PACK_SUFFIX IB_MULTIPATH_RECORD; - - - -/* -------------------------------------------------------------------------- - * VFabric Record - */ -/* ComponentMask bits */ -#define VEND_VF_RECORD_COMP_INDEX 0x00000001 -#define VEND_VF_RECORD_COMP_PKEY 0x00000002 -#define VEND_VF_RECORD_COMP_NAME 0x00000008 -#define VEND_VF_RECORD_COMP_SERVICEID 0x00000010 -#define VEND_VF_RECORD_COMP_MGID 0x00000020 -#define VEND_VF_RECORD_COMP_SL 0x00000080 - -#define VEND_VFABRIC_NAME_COUNT 64 - -#define VEND_PKEY_SEL 0x01 -#define VEND_SL_SEL 0x02 - -#define OPT_VF_SECURITY 0x01 -#define OPT_VF_QOS 0x02 -#define OPT_VF_FLOW_DISABLE 0x04 - - -typedef struct _VF_INFO_RECORD { - uint16 vfIndex; /* The index assigned to the VF */ - uint16 pKey; /* PKey associated with the VF */ - uint32 rsvd6; - uint8 vfName[64]; /* The name of the VF */ - uint64 ServiceID; /* for query only */ - IB_GID MGID; /* for query only */ - struct { -#if CPU_BE - uint8 selectFlags:4; /* 1 bit to indicate SL in queries, 1 bit for pkey, - 4bits total */ - uint8 sl: 4; /* service level - 4 bits */ -#else - uint8 sl: 4; /* service level - 4 bits */ - uint8 selectFlags:4; /* 1 bit to indicate SL in queries, 1 bit for pkey, - 4bits total */ -#endif -#if CPU_BE - uint8 mtuSpecified:1; /* mtu specified for VF - 1 bit */ - uint8 rsvd1:1; - uint8 mtu:6; /* max mtu assigned to VF - 6 bits */ -#else - uint8 mtu:6; /* max mtu assigned to VF - 6 bits */ - uint8 rsvd1:1; - uint8 mtuSpecified:1; /* mtu specified for VF - 1 bit */ -#endif -#if CPU_BE - uint8 rateSpecified:1; /* rate specified for VF - 1 bit */ - uint8 rsvd2:1; - uint8 rate:6; /* max rate assigned to VF - 6 bits */ -#else - uint8 rate:6; /* max rate assigned to VF - 6 bits */ - uint8 rsvd2:1; - uint8 rateSpecified:1; /* rate specified for VF - 1 bit */ -#endif -#if CPU_BE - uint8 pktLifeSpecified:1; /* pkt life time specified for VF - 1 bit */ - uint8 rsvd3:4; - uint8 pktLifeTimeInc:3; /* pkt life time assigned to VF - 3 bits */ -#else - uint8 pktLifeTimeInc:3; /* pkt life time assigned to VF - 3 bits */ - uint8 rsvd3:4; - uint8 pktLifeSpecified:1; /* pkt life time specified for VF - 1 bit */ -#endif - } s1; - uint8 optionFlags; /* security bit, QoS bit, 6 reserved */ - uint8 bandwidthPercent; /* bandwidth percentage, 8 bits */ - struct { -#if CPU_BE - uint8 rsvd4:7; - uint8 priority:1; /* priority, 1 bit */ -#else - uint8 priority:1; /* priority, 1 bit */ - uint8 rsvd4:7; -#endif - } s2; - uint8 routingSLs; - uint8 rsvd5[24]; - -} PACK_SUFFIX VEND_VFINFO_RECORD; - -/* -------------------------------------------------------------------------- - * Vendor unique collective group Record - */ - -#define VEND_CG_RECORD_COMPONENTMASK_CGID 0x0000000000000001ull -#define VEND_CG_RECORD_COMPONENTMASK_NODE 0x0000000000000002ull - -typedef struct _COLLECTIVE_GROUP_RECORD { - uint64_t cgid; // a hash which uniquely identifies the group - uint64_t nodeGuid; // node making the request - uint16_t clid; // collective group lid (assigned by SA/SM on create) - uint16_t numMembers; // the number of node members in the group - uint8_t auxStatus; // auxiliary status info returned on set/delete - uint8_t isFinal; // Valid on Delete, indicates release Immediate - 1 bit - uint32_t rsvd1; // Reserved - 19 bits - uint8_t sl; // service level - 4 bits - uint16_t pKey; - uint8_t mtuSelector; - uint8_t mtuValue; - uint8_t rateSelector; - uint8_t rateValue; -} PACK_SUFFIX VEND_COLLECTIVE_GROUP_RECORD; - - -/* -------------------------------------------------------------------------- - * Vendor unique collective group status Record - */ - -#define VEND_CGS_RECORD_COMPONENTMASK_CLID 0x0000000000000001ull -#define VEND_CGS_RECORD_COMPONENTMASK_LID 0x0000000000000002ull - -#define VEND_CG_STATUS_PROTOCOL_ERROR 0x1 - -typedef struct _COLLECTIVE_GROUP_STATUS_RECORD { - uint16_t clid; // collective group lid - uint16_t lid; // lid of node reporting protocol error - uint8_t cgStatus; // collective group status -} PACK_SUFFIX VEND_COLLECTIVE_GROUP_STATUS_RECORD; - - -/* -------------------------------------------------------------------------- - * Vendor unique CFT Record - */ - -#define VEND_CFT_RECORD_COMPONENTMASK_CLID 0x0000000000000001ull -#define VEND_CFT_RECORD_COMPONENTMASK_LID 0x0000000000000002ull - -typedef struct _COLLECTIVE_GROUP_FORWARDING_TABLE_RECORD { - uint16_t clid; // collective group lid - uint16_t lid; // lid of node reporting protocol error - COLLECTIVE_FORWARDING_TABLE cft; // collective forwarding table -} PACK_SUFFIX VEND_COLLECTIVE_GROUP_FORWARDING_TABLE_RECORD; - - #include "iba/public/ipackoff.h" -/*--------------------------------------------------------------------------- - * Swap between CPU and network byte ordering - */ - -static __inline -void -BSWAP_IB_NODE_RECORD( - IB_NODE_RECORD *Dest - ) -{ -#if CPU_LE - Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); - BSWAP_NODE_INFO(&Dest->NodeInfoData); -#endif /* CPU_LE */ -} - -static __inline -void -BSWAP_IB_PORTINFO_RECORD( - IB_PORTINFO_RECORD *Dest, int extended - ) -{ -#if CPU_LE - - Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); - BSWAP_PORT_INFO(&Dest->PortInfoData, extended); -#endif -} - -static __inline -void -BSWAP_IB_SWITCHINFO_RECORD( - IB_SWITCHINFO_RECORD *Dest - ) -{ -#if CPU_LE - - Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); - BSWAP_SWITCH_INFO(&Dest->SwitchInfoData); -#endif -} - -static __inline -void -BSWAP_IB_LINEAR_FDB_RECORD( - IB_LINEAR_FDB_RECORD *Dest - ) -{ -#if CPU_LE - Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); - BSWAP_LINEAR_FWD_TABLE(&Dest->LinearFdbData); -#endif -} - -static __inline -void -BSWAP_IB_RANDOM_FDB_RECORD( - IB_RANDOM_FDB_RECORD *Dest - ) -{ -#if CPU_LE - Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); - BSWAP_RANDOM_FWD_TABLE(&Dest->RandomFdbData); -#endif -} - -static __inline -void -BSWAP_IB_MCAST_FDB_RECORD( - IB_MCAST_FDB_RECORD *Dest - ) -{ -#if CPU_LE - Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); - BSWAP_MCAST_FWD_TABLE(&Dest->MCastFdbData); -#endif -} - -static __inline -void -BSWAP_IB_VLARBTABLE_RECORD( - IB_VLARBTABLE_RECORD *Dest - ) -{ -#if CPU_LE - Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); - BSWAP_VLARBTABLE(&Dest->VLArbData); -#endif -} - -static __inline -void -BSWAP_IB_SMINFO_RECORD( - IB_SMINFO_RECORD *Dest - ) -{ -#if CPU_LE - Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); - BSWAP_SM_INFO(&Dest->SMInfoData); -#endif -} - -static __inline -void -BSWAP_IB_P_KEY_TABLE_RECORD( - IB_P_KEY_TABLE_RECORD *Dest - ) -{ -#if CPU_LE - Dest->RID.s2.AsReg32 = ntoh32(Dest->RID.s2.AsReg32); - BSWAP_PART_TABLE(&Dest->PKeyTblData); -#endif -} - -static __inline -void -BSWAP_IB_INFORM_INFO_RECORD( - IB_INFORM_INFO_RECORD *Dest - ) -{ -#if CPU_LE - BSWAP_IB_GID(&Dest->RID.SubscriberGID); - Dest->RID.Enum = ntoh16(Dest->RID.Enum); - BSWAP_INFORM_INFO(&Dest->InformInfoData); -#endif -} - -static __inline -void -BSWAP_IB_LINK_RECORD( - IB_LINK_RECORD *Dest - ) -{ -#if CPU_LE - Dest->RID.FromLID = ntoh16(Dest->RID.FromLID); - Dest->ToLID = ntoh16(Dest->ToLID); -#endif /* CPU_LE */ -} - -static __inline -void -BSWAP_IB_SERVICE_RECORD( - IB_SERVICE_RECORD *Dest - ) -{ -#if CPU_LE - uint8 i; - - Dest->RID.ServiceID = ntoh64(Dest->RID.ServiceID); - BSWAP_IB_GID(&Dest->RID.ServiceGID); - Dest->RID.ServiceP_Key = ntoh16(Dest->RID.ServiceP_Key); - Dest->ServiceLease = ntoh32(Dest->ServiceLease); - ntoh(&Dest->ServiceKey[0], &Dest->ServiceKey[0], 16); - - for (i=0; i<8; ++i) - { - Dest->ServiceData16[i] = ntoh16(Dest->ServiceData16[i]); - } - for (i=0; i<4; ++i) - { - Dest->ServiceData32[i] = ntoh32(Dest->ServiceData32[i]); - } - for (i=0; i<2; ++i) - { - Dest->ServiceData64[i] = ntoh64(Dest->ServiceData64[i]); - } -#endif /* CPU_LE */ -} - -static __inline -void -BSWAP_IB_SERVICEASSOCIATION_RECORD( - IB_SERVICEASSOCIATION_RECORD *Dest - ) -{ -#if CPU_LE - ntoh(&Dest->ServiceKey[0], &Dest->ServiceKey[0], 16); -#endif -} - -static __inline -void -BSWAP_IB_MCMEMBER_RECORD( - IB_MCMEMBER_RECORD *Dest - ) -{ -#if CPU_LE - BSWAP_IB_GID(&Dest->RID.MGID); - BSWAP_IB_GID(&Dest->RID.PortGID); - Dest->Q_Key = ntoh32(Dest->Q_Key); - Dest->MLID = ntoh16(Dest->MLID); - Dest->P_Key = ntoh16(Dest->P_Key); - Dest->u1.AsReg32 = ntoh32(Dest->u1.AsReg32); -#endif /* CPU_LE */ -} - -static __inline -void -BSWAPCOPY_IB_MCMEMBER_RECORD(IB_MCMEMBER_RECORD *Src, IB_MCMEMBER_RECORD *Dest) -{ - memcpy(Dest, Src, sizeof(IB_MCMEMBER_RECORD)); - BSWAP_IB_MCMEMBER_RECORD(Dest); -} - -static __inline -void -BSWAP_IB_TRACE_RECORD( - IB_TRACE_RECORD *Dest - ) -{ -#if CPU_LE - Dest->GIDPrefix = ntoh64(Dest->GIDPrefix); - Dest->IDGeneration = ntoh16(Dest->IDGeneration); - Dest->NodeID = ntoh64(Dest->NodeID); - Dest->ChassisID = ntoh64(Dest->ChassisID); - Dest->EntryPortID = ntoh64(Dest->EntryPortID); - Dest->ExitPortID = ntoh64(Dest->ExitPortID); -#endif -} - -static __inline -void -BSWAP_IB_MULTIPATH_RECORD( - IB_MULTIPATH_RECORD *Dest - ) -{ -#if CPU_LE - uint8 i; - Dest->u1.AsReg32 = ntoh32(Dest->u1.AsReg32); - Dest->P_Key = ntoh16(Dest->P_Key); - Dest->u2.AsReg16 = ntoh16(Dest->u2.AsReg16); - - /* TBD - sanity check Counts */ - for (i=0; i<(Dest->SGIDCount + Dest->DGIDCount); ++i) - { - BSWAP_IB_GID(&Dest->GIDList[i]); - } -#endif -} - -static __inline -void -BSWAPCOPY_IB_MULTIPATH_RECORD( - IB_MULTIPATH_RECORD *Src, IB_MULTIPATH_RECORD *Dest - ) -{ - memcpy(Dest, Src, sizeof(IB_MULTIPATH_RECORD)); - BSWAP_IB_MULTIPATH_RECORD(Dest); -} - -static __inline -void -BSWAP_IB_PATH_RECORD( - IB_PATH_RECORD *Dest - ) -{ -#if CPU_LE - Dest->ServiceID = ntoh64(Dest->ServiceID); - BSWAP_IB_GID(&Dest->DGID); - BSWAP_IB_GID(&Dest->SGID); - - Dest->DLID = ntoh16(Dest->DLID); - Dest->SLID = ntoh16(Dest->SLID); - Dest->u1.AsReg32 = ntoh32(Dest->u1.AsReg32); - Dest->P_Key = ntoh16(Dest->P_Key); - Dest->u2.AsReg16 = ntoh16(Dest->u2.AsReg16); -#endif /* CPU_LE */ -} - -static __inline -void -BSWAPCOPY_IB_PATH_RECORD( - IB_PATH_RECORD *Src, IB_PATH_RECORD *Dest - ) -{ - memcpy(Dest, Src, sizeof(IB_PATH_RECORD)); - BSWAP_IB_PATH_RECORD(Dest); -} - -static __inline -void -BSWAP_VEND_VFINFO_RECORD( - VEND_VFINFO_RECORD *Dest - ) -{ -#if CPU_LE - Dest->vfIndex = ntoh16(Dest->vfIndex); - Dest->pKey = ntoh16(Dest->pKey); - Dest->ServiceID = ntoh64(Dest->ServiceID); - BSWAP_IB_GID(&Dest->MGID); -#endif /* CPU_LE */ -} - -static __inline -void -BSWAP_VEND_COLLECTIVE_GROUP_RECORD( - VEND_COLLECTIVE_GROUP_RECORD *Dest - ) -{ -#if CPU_LE - Dest->cgid = ntoh64(Dest->cgid); - Dest->nodeGuid = ntoh64(Dest->nodeGuid); - Dest->clid = ntoh16(Dest->clid); - Dest->numMembers = ntoh16(Dest->numMembers); - Dest->rsvd1 = ntoh32(Dest->rsvd1); - Dest->pKey = ntoh16(Dest->pKey); -#endif /* CPU_LE */ -} - -static __inline -void -BSWAP_VEND_COLLECTIVE_GROUP_STATUS_RECORD( - VEND_COLLECTIVE_GROUP_STATUS_RECORD *Dest - ) -{ -#if CPU_LE - Dest->clid = ntoh16(Dest->clid); - Dest->lid = ntoh16(Dest->lid); -#endif /* CPU_LE */ -} - -static __inline -void -BSWAP_VEND_COLLECTIVE_GROUP_FORWARDING_TABLE_RECORD( - VEND_COLLECTIVE_GROUP_FORWARDING_TABLE_RECORD *Dest - ) -{ -#if CPU_LE - Dest->clid = ntoh16(Dest->clid); - Dest->lid = ntoh16(Dest->lid); - BSWAP_COLLECTIVE_FORWARDING_TABLE(&Dest->cft); -#endif /* CPU_LE */ -} - - - -/* determine if the given PATH_RECORD represents a global route - * (eg. where GRH is used to go through an IB Router) - */ -static __inline boolean -IsGlobalRoute( IN const IB_PATH_RECORD *pPathRecord) -{ - return (pPathRecord->u1.s.HopLimit > 1); -} - -/* compute LocalAckTimeout from PktLifeTime - * note PktLifetime is one directional on wire, while LocalAckTimeout is - * total round trip including CA Ack Delay - * for client REQ.AckTimeout, caAckDelay should be our local CA's AckDelay - * for client QP, use REP.TargetAckDelay - * for server QP, use REQ.AckTimeout directly (no need to call this) - * pktLifeTime, caAckDelay and returned values are IB timeout multipliers - */ -static __inline uint8 -ComputeAckTimeout(IN uint8 pktLifeTime, IN uint8 caAckDelay) -{ - /* return TimeoutTimeToMult(TimeoutMultToTimeInUsec(pktLifeTime)*2 */ - /* + TimeoutMultToTimeInUsec(caAckDelay)); */ - /*return MIN(pktLifeTime + 2, 0x1f); */ - uint8 ackTimeout; - - /* tests also handle if remote endpoint didn't set REP.TargetAckDelay */ - if (pktLifeTime+1 >= caAckDelay) - { - /* since its a log2 value, +1 doubles the timeout */ - /* Additional +1 is to account for remote CA Ack delay */ - ackTimeout = pktLifeTime+2; - } else { - /* since caAckDelay > 2*pktLifetime, +1 simply doubles ca Ack Delay */ - ackTimeout = caAckDelay+1; - } - /* limit value to 5 bits (approx 2.4 hours) */ - if (ackTimeout > 0x1f) - ackTimeout = 0x1f; - return ackTimeout; -} - -#ifndef IB_STACK_OPENIB -/* helper function, converts a PATH_RECORD to an IB_ADDRESS_VECTOR to facilitate - * connection establishment and UD traffic - * PathMTU is an IB_MTU enum - */ -static __inline void -GetAVFromPath2( IN uint64 PortGuid, /* only needed for UD AVs */ - IN const IB_PATH_RECORD *pPathRecord, - OUT uint8* PathMTU OPTIONAL, - OUT IB_ADDRESS_VECTOR* DestAv OPTIONAL ) -{ - if (DestAv) - { - DestAv->PortGUID = PortGuid; /* only needed for UD AVs */ - DestAv->DestLID = pPathRecord->DLID; - DestAv->PathBits = (uint8)(pPathRecord->SLID&IB_PATHBITS_MASK); - DestAv->ServiceLevel = pPathRecord->u2.s.SL; - DestAv->StaticRate = pPathRecord->Rate; - - /* Global route information. */ - DestAv->GlobalRoute = IsGlobalRoute(pPathRecord); - DestAv->GlobalRouteInfo.DestGID = pPathRecord->DGID; - DestAv->GlobalRouteInfo.FlowLabel = pPathRecord->u1.s.FlowLabel; - DestAv->GlobalRouteInfo.HopLimit = (uint8)pPathRecord->u1.s.HopLimit; - DestAv->GlobalRouteInfo.SrcGIDIndex = 0; /* BUGBUG assume 0 */ - DestAv->GlobalRouteInfo.TrafficClass = pPathRecord->TClass; - } - - /* Reliable connection information, N/A for UD */ - if (PathMTU) - *PathMTU = pPathRecord->Mtu; -} - -/* This function is depricated, will be dropped in 3.1 release, - * use GetAVFromPath2 above - */ -static __inline void -GetAVFromPath( IN uint64 PortGuid, /* only needed for UD AVs */ - IN const IB_PATH_RECORD *pPathRecord, - OUT uint8* PathMTU OPTIONAL, OUT uint8* LocalAckTimeout OPTIONAL, - OUT IB_ADDRESS_VECTOR* DestAv OPTIONAL ) -{ - GetAVFromPath2(PortGuid, pPathRecord, PathMTU, DestAv); - if (LocalAckTimeout) - *LocalAckTimeout = ComputeAckTimeout(pPathRecord->PktLifeTime, - TimeoutTimeToMult(8)); /* guess: 8 ms */ -} - -/* helper function, converts a MCMEMBER_RECORD to an IB_ADDRESS_VECTOR to - * facilitate UD traffic - */ -static __inline void -GetAVFromMcMemberRecord(EUI64 PortGuid, - IB_MCMEMBER_RECORD *pMcMemberRecord, - IB_ADDRESS_VECTOR *pDestAv ) -{ - if (pDestAv != NULL) - { - pDestAv->PortGUID = pMcMemberRecord->RID.PortGID.Type.Global.InterfaceID; - pDestAv->DestLID = pMcMemberRecord->MLID; -/* pDestAv->PathBits = (uint8)pPathRecord->SLID; */ - pDestAv->PathBits = 0; - pDestAv->ServiceLevel = pMcMemberRecord->u1.s.SL; - pDestAv->StaticRate = pMcMemberRecord->Rate; - - /* Global route information. */ - pDestAv->GlobalRoute = TRUE; - pDestAv->GlobalRouteInfo.DestGID = pMcMemberRecord->RID.MGID; - pDestAv->GlobalRouteInfo.FlowLabel = pMcMemberRecord->u1.s.FlowLabel; - pDestAv->GlobalRouteInfo.HopLimit = (uint8)pMcMemberRecord->u1.s.HopLimit; - pDestAv->GlobalRouteInfo.SrcGIDIndex = 0; /* BUGBUG assume 0 */ - pDestAv->GlobalRouteInfo.TrafficClass = pMcMemberRecord->TClass; - } -} - - - -#endif /* IB_STACK_OPENIB */ - #ifdef __cplusplus } #endif diff --git a/IbAccess/Common/Inc/ib_sa_records_priv.h b/IbAccess/Common/Inc/ib_sa_records_priv.h new file mode 100644 index 00000000..06203aed --- /dev/null +++ b/IbAccess/Common/Inc/ib_sa_records_priv.h @@ -0,0 +1,653 @@ +/* BEGIN_ICS_COPYRIGHT3 **************************************** + +Copyright (c) 2015-17, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +** END_ICS_COPYRIGHT3 ****************************************/ + +/* [ICS VERSION STRING: unknown] */ + +#ifndef _IBA_IB_SA_RECORDS_PRIV_H_ +#define _IBA_IB_SA_RECORDS_PRIV_H_ + +#include "iba/ib_sm_priv.h" +#include "iba/ib_sa_records.h" +#include "iba/stl_helper.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#include "iba/public/ipackon.h" + +static __inline void +BSWAP_IB_NODE_RECORD( + IB_NODE_RECORD *Dest + ) +{ +#if CPU_LE + Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); + BSWAP_NODE_INFO(&Dest->NodeInfoData); +#endif /* CPU_LE */ +} + +static __inline void +BSWAP_IB_PORTINFO_RECORD( + IB_PORTINFO_RECORD *Dest, int extended + ) +{ +#if CPU_LE + + Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); + BSWAP_PORT_INFO(&Dest->PortInfoData, extended); +#endif +} + +/* -------------------------------------------------------------------------- + * Switch Info Record - information about a switch in the fabric + */ + +/* ComponentMask bits */ +#define IB_SWITCHINFO_RECORD_COMP_LID 0x00000001 + /* reserved field 0x00000002*/ + /* switch info fields */ +#define IB_SWITCHINFO_RECORD_COMP_LINEARFDBCAP 0x00000004 +#define IB_SWITCHINFO_RECORD_COMP_RANDOMFDBCAP 0x00000008 +#define IB_SWITCHINFO_RECORD_COMP_MULTICASTFDBCAP 0x00000010 +#define IB_SWITCHINFO_RECORD_COMP_LINEARFDBTOP 0x00000020 +#define IB_SWITCHINFO_RECORD_COMP_DEFAULTPORT 0x00000040 +#define IB_SWITCHINFO_RECORD_COMP_DEFAULTMULTICASTPRIMARYPORT 0x00000080 +#define IB_SWITCHINFO_RECORD_COMP_DEFAULTMULTICASTNOTPRIMARYPORT 0x00000100 +#define IB_SWITCHINFO_RECORD_COMP_LIFETIMEVALUE 0x00000200 +#define IB_SWITCHINFO_RECORD_COMP_PORTSTATECHANGE 0x00000400 + /* reserved field 0x00000800*/ +#define IB_SWITCHINFO_RECORD_COMP_LIDSPERPORT 0x00001000 +#define IB_SWITCHINFO_RECORD_COMP_PARTITIONENFORCEMENTCAP 0x00002000 +#define IB_SWITCHINFO_RECORD_COMP_INBOUNDENFORCEMENTCAP 0x00004000 +#define IB_SWITCHINFO_RECORD_COMP_OUTBOUNDENFORCEMENTCAP 0x00008000 +#define IB_SWITCHINFO_RECORD_COMP_FILTERRAWINBOUNDCAP 0x00010000 +#define IB_SWITCHINFO_RECORD_COMP_FILTERRAWOUTBOUNDCAP 0x00020000 +#define IB_SWITCHINFO_RECORD_COMP_ENHANCEDPORT0 0x00040000 + /* reserved field 0x00080000*/ + +typedef struct _IB_SWITCHINFO_RECORD { + union { + uint32 AsReg32; + struct { +#if CPU_BE + uint32 LID:16; + uint32 Reserved:16; +#else + uint32 Reserved:16; + uint32 LID:16; +#endif + } PACK_SUFFIX s; + } RID; + SWITCH_INFO SwitchInfoData; +} PACK_SUFFIX IB_SWITCHINFO_RECORD; + +static __inline void +BSWAP_IB_SWITCHINFO_RECORD( + IB_SWITCHINFO_RECORD *Dest + ) +{ +#if CPU_LE + + Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); + BSWAP_SWITCH_INFO(&Dest->SwitchInfoData); +#endif +} + +/* -------------------------------------------------------------------------- + * Linear Forwarding Table Record - linear forwarding table for a switch in the fabric + */ + +/* ComponentMask bits */ +#define IB_LINEARFDB_RECORD_COMP_LID 0x00000001 +#define IB_LINEARFDB_RECORD_COMP_BLOCKNUM 0x00000002 + /* reserved field 0x00000004 */ + /* linear forwarding table fields */ + /* Note insufficient bits in component mask to select */ + /* all 64 entries in record */ + +typedef struct _IB_LINEAR_FDB_RECORD { + union { + uint32 AsReg32; + struct { +#if CPU_BE + uint32 LID:16; + uint32 BlockNum:16; +#else + uint32 BlockNum:16; + uint32 LID:16; +#endif + } PACK_SUFFIX s; + } RID; + uint32 Reserved; + FORWARDING_TABLE LinearFdbData; +} PACK_SUFFIX IB_LINEAR_FDB_RECORD; + +static __inline void +BSWAP_IB_LINEAR_FDB_RECORD( + IB_LINEAR_FDB_RECORD *Dest + ) +{ +#if CPU_LE + Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); + BSWAP_LINEAR_FWD_TABLE(&Dest->LinearFdbData); +#endif +} + +/* -------------------------------------------------------------------------- + * Random Forwarding Table Record - random forwarding table for a switch in the fabric + */ + +/* ComponentMask bits */ +#define IB_RANDOMFDB_RECORD_COMP_LID 0x00000001 +#define IB_RANDOMFDB_RECORD_COMP_BLOCKNUM 0x00000002 + /* reserved field 0x00000004 */ + /* random forwarding table fields */ + /* Note insufficient bits in component mask to select */ + /* all 5 fields in all 16 entries in record */ + +typedef struct _IB_RANDOM_FDB_RECORD { + union { + uint32 AsReg32; + struct { +#if CPU_BE + uint32 LID:16; + uint32 BlockNum:16; +#else + uint32 BlockNum:16; + uint32 LID:16; +#endif + } PACK_SUFFIX s; + } RID; + uint32 Reserved; + FORWARDING_TABLE RandomFdbData; +} PACK_SUFFIX IB_RANDOM_FDB_RECORD; + +static __inline void +BSWAP_IB_RANDOM_FDB_RECORD( + IB_RANDOM_FDB_RECORD *Dest + ) +{ +#if CPU_LE + Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); + BSWAP_RANDOM_FWD_TABLE(&Dest->RandomFdbData); +#endif +} + +/* -------------------------------------------------------------------------- + * Multicast Forwarding Table Record - multicast forwarding table for a + * switch in the fabric + */ + +/* ComponentMask bits */ +#define IB_MCASTFDB_RECORD_COMP_LID 0x00000001 +#define IB_MCASTFDB_RECORD_COMP_POSITION 0x00000002 + /* reserved field 0x00000004 */ +#define IB_MCASTFDB_RECORD_COMP_BLOCKNUM 0x00000008 + /* reserved field 0x00000010 */ + /* multicast forwarding table fields */ + /* limited value to select on these, so omitted defines */ + +typedef struct _IB_MCAST_FDB_RECORD { + union { + uint32 AsReg32; + struct { +#if CPU_BE + uint32 LID:16; + uint32 Position:4; + uint32 Reserved0:3; + uint32 BlockNum:9; +#else + uint32 BlockNum:9; + uint32 Reserved0:3; + uint32 Position:4; + uint32 LID:16; +#endif + } PACK_SUFFIX s; + } RID; + uint32 Reserved; + FORWARDING_TABLE MCastFdbData; +} PACK_SUFFIX IB_MCAST_FDB_RECORD; + +static __inline void +BSWAP_IB_MCAST_FDB_RECORD( + IB_MCAST_FDB_RECORD *Dest + ) +{ +#if CPU_LE + Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); + BSWAP_MCAST_FWD_TABLE(&Dest->MCastFdbData); +#endif +} + +/* -------------------------------------------------------------------------- + * VL Arbitration Table Record - VL priority controls for a port on a node in + * the fabric + */ + +/* ComponentMask bits */ +#define IB_VLARBTABLE_RECORD_COMP_LID 0x00000001 +#define IB_VLARBTABLE_RECORD_COMP_OUTPUTPORTNUM 0x00000002 +#define IB_VLARBTABLE_RECORD_COMP_BLOCKNUM 0x00000004 + /* reserved field 0x00000008 */ + /* Note insufficient bits in component mask to select */ + /* all 3 fields in all 32 entries in record */ + +typedef struct _IB_VLARBTABLE_RECORD { + union { + uint32 AsReg32; + struct { +#if CPU_BE + uint32 LID:16; + uint32 OutputPortNum:8; + uint32 BlockNum:8; +#else + uint32 BlockNum:8; + uint32 OutputPortNum:8; + uint32 LID:16; +#endif + } PACK_SUFFIX s; + } RID; + uint32 Reserved; + VLARBTABLE VLArbData; /* VLArbitration attribute */ +} PACK_SUFFIX IB_VLARBTABLE_RECORD; + +static __inline void +BSWAP_IB_VLARBTABLE_RECORD( + IB_VLARBTABLE_RECORD *Dest + ) +{ +#if CPU_LE + Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); + BSWAP_VLARBTABLE(&Dest->VLArbData); +#endif +} + +/* -------------------------------------------------------------------------- + * SM Info Record - basic information about an SM in the fabric + */ + +/* ComponentMask bits */ +#define IB_SMINFO_RECORD_COMP_LID 0x00000001 + /* reserved field 0x00000002 */ + /* SM Info fields */ +#define IB_SMINFO_RECORD_COMP_GUID 0x00000004 +#define IB_SMINFO_RECORD_COMP_SMKEY 0x00000008 +#define IB_SMINFO_RECORD_COMP_ACTCOUNT 0x00000010 +#define IB_SMINFO_RECORD_COMP_PRIORITY 0x00000020 +#define IB_SMINFO_RECORD_COMP_SMSTATE 0x00000040 + +typedef struct _IB_SMINFO_RECORD { + union { + uint32 AsReg32; + struct { +#if CPU_BE + uint32 LID:16; + uint32 Reserved:16; +#else + uint32 Reserved:16; + uint32 LID:16; +#endif + } PACK_SUFFIX s; + } RID; + SM_INFO SMInfoData; /* SMInfo attribute */ +} PACK_SUFFIX IB_SMINFO_RECORD; + +static __inline void +BSWAP_IB_SMINFO_RECORD( + IB_SMINFO_RECORD *Dest + ) +{ +#if CPU_LE + Dest->RID.AsReg32 = ntoh32(Dest->RID.AsReg32); + BSWAP_SM_INFO(&Dest->SMInfoData); +#endif +} + +/* -------------------------------------------------------------------------- + * P_Key Table Record - P-Key configuration for a port on a node in the fabric + */ + +/* ComponentMask bits */ +#define IB_PKEYTABLE_RECORD_COMP_LID 0x00000001 +#define IB_PKEYTABLE_RECORD_COMP_BLOCKNUM 0x00000002 +#define IB_PKEYTABLE_RECORD_COMP_PORTNUM 0x00000004 + /* reserved field 0x00000008 */ + /* P Key Table fields */ + /* limited value to select on these, so omitted defines */ + +typedef struct _IB_P_KEY_TABLE_RECORD { + union { + struct { + uint32 AsReg32; + uint8 Byte; + } PACK_SUFFIX s2; + struct { +#if CPU_BE + uint32 LID:16; + uint32 BlockNum:16; +#else + uint32 BlockNum:16; + uint32 LID:16; +#endif + uint8 PortNum; + } PACK_SUFFIX s; + } PACK_SUFFIX RID; + uint8 Reserved[3]; + PARTITION_TABLE PKeyTblData; /* PartitionTable for this port */ +} PACK_SUFFIX IB_P_KEY_TABLE_RECORD; + +static __inline void +BSWAP_IB_P_KEY_TABLE_RECORD( + IB_P_KEY_TABLE_RECORD *Dest + ) +{ +#if CPU_LE + Dest->RID.s2.AsReg32 = ntoh32(Dest->RID.s2.AsReg32); + BSWAP_PART_TABLE(&Dest->PKeyTblData); +#endif +} + +static __inline void +BSWAP_IB_INFORM_INFO_RECORD( + IB_INFORM_INFO_RECORD *Dest + ) +{ +#if CPU_LE + BSWAP_IB_GID(&Dest->RID.SubscriberGID); + Dest->RID.Enum = ntoh16(Dest->RID.Enum); + BSWAP_INFORM_INFO(&Dest->InformInfoData); +#endif +} + +/* -------------------------------------------------------------------------- + * Link Record - details about a link in the fabric + */ + +/* ComponentMask bits */ +#define IB_LINK_RECORD_COMP_FROMLID 0x00000001 +#define IB_LINK_RECORD_COMP_FROMPORT 0x00000002 +#define IB_LINK_RECORD_COMP_TOPORT 0x00000004 +#define IB_LINK_RECORD_COMP_TOLID 0x00000008 + +typedef struct _IB_LINK_RECORD { + struct { + uint16 FromLID; /* From this LID */ + uint8 FromPort; /* From port number */ + } PACK_SUFFIX RID; + uint8 ToPort; /* To port number */ + uint16 ToLID; /* To this LID */ +} PACK_SUFFIX IB_LINK_RECORD; + +static __inline void +BSWAP_IB_LINK_RECORD( + IB_LINK_RECORD *Dest + ) +{ +#if CPU_LE + Dest->RID.FromLID = ntoh16(Dest->RID.FromLID); + Dest->ToLID = ntoh16(Dest->ToLID); +#endif /* CPU_LE */ +} + +static __inline void +BSWAP_IB_SERVICE_RECORD( + IB_SERVICE_RECORD *Dest + ) +{ +#if CPU_LE + uint8 i; + + Dest->RID.ServiceID = ntoh64(Dest->RID.ServiceID); + BSWAP_IB_GID(&Dest->RID.ServiceGID); + Dest->RID.ServiceP_Key = ntoh16(Dest->RID.ServiceP_Key); + Dest->ServiceLease = ntoh32(Dest->ServiceLease); + ntoh(&Dest->ServiceKey[0], &Dest->ServiceKey[0], 16); + + for (i=0; i<8; ++i) + { + Dest->ServiceData16[i] = ntoh16(Dest->ServiceData16[i]); + } + for (i=0; i<4; ++i) + { + Dest->ServiceData32[i] = ntoh32(Dest->ServiceData32[i]); + } + for (i=0; i<2; ++i) + { + Dest->ServiceData64[i] = ntoh64(Dest->ServiceData64[i]); + } +#endif /* CPU_LE */ +} + +static __inline void +BSWAP_IB_MCMEMBER_RECORD( + IB_MCMEMBER_RECORD *Dest + ) +{ +#if CPU_LE + BSWAP_IB_GID(&Dest->RID.MGID); + BSWAP_IB_GID(&Dest->RID.PortGID); + Dest->Q_Key = ntoh32(Dest->Q_Key); + Dest->MLID = ntoh16(Dest->MLID); + Dest->P_Key = ntoh16(Dest->P_Key); + Dest->u1.AsReg32 = ntoh32(Dest->u1.AsReg32); +#endif /* CPU_LE */ +} + +static __inline void +BSWAPCOPY_IB_MCMEMBER_RECORD(IB_MCMEMBER_RECORD *Src, IB_MCMEMBER_RECORD *Dest) +{ + memcpy(Dest, Src, sizeof(IB_MCMEMBER_RECORD)); + BSWAP_IB_MCMEMBER_RECORD(Dest); +} + +static __inline void +BSWAP_IB_TRACE_RECORD( + IB_TRACE_RECORD *Dest + ) +{ +#if CPU_LE + Dest->GIDPrefix = ntoh64(Dest->GIDPrefix); + Dest->IDGeneration = ntoh16(Dest->IDGeneration); + Dest->NodeID = ntoh64(Dest->NodeID); + Dest->ChassisID = ntoh64(Dest->ChassisID); + Dest->EntryPortID = ntoh64(Dest->EntryPortID); + Dest->ExitPortID = ntoh64(Dest->ExitPortID); +#endif +} + +static __inline void +BSWAP_IB_MULTIPATH_RECORD( + IB_MULTIPATH_RECORD *Dest + ) +{ +#if CPU_LE + uint8 i; + Dest->u1.AsReg32 = ntoh32(Dest->u1.AsReg32); + Dest->P_Key = ntoh16(Dest->P_Key); + Dest->u2.AsReg16 = ntoh16(Dest->u2.AsReg16); + + /* TBD - sanity check Counts */ + for (i=0; i<(Dest->SGIDCount + Dest->DGIDCount); ++i) + { + BSWAP_IB_GID(&Dest->GIDList[i]); + } +#endif +} + +static __inline void +BSWAP_IB_PATH_RECORD( + IB_PATH_RECORD *Dest + ) +{ +#if CPU_LE + Dest->ServiceID = ntoh64(Dest->ServiceID); + BSWAP_IB_GID(&Dest->DGID); + BSWAP_IB_GID(&Dest->SGID); + + Dest->DLID = ntoh16(Dest->DLID); + Dest->SLID = ntoh16(Dest->SLID); + Dest->u1.AsReg32 = ntoh32(Dest->u1.AsReg32); + Dest->P_Key = ntoh16(Dest->P_Key); + Dest->u2.AsReg16 = ntoh16(Dest->u2.AsReg16); +#endif /* CPU_LE */ +} + +static __inline void +BSWAPCOPY_IB_PATH_RECORD( + IB_PATH_RECORD *Src, IB_PATH_RECORD *Dest + ) +{ + memcpy(Dest, Src, sizeof(IB_PATH_RECORD)); + BSWAP_IB_PATH_RECORD(Dest); +} + +/* determine if the given PATH_RECORD represents a global route + * (eg. where GRH is used to go through an IB Router) + */ +static __inline boolean +IsGlobalRoute( IN const IB_PATH_RECORD *pPathRecord) +{ + return (pPathRecord->u1.s.HopLimit > 1); +} + +/* compute LocalAckTimeout from PktLifeTime + * note PktLifetime is one directional on wire, while LocalAckTimeout is + * total round trip including CA Ack Delay + * for client REQ.AckTimeout, caAckDelay should be our local CA's AckDelay + * for client QP, use REP.TargetAckDelay + * for server QP, use REQ.AckTimeout directly (no need to call this) + * pktLifeTime, caAckDelay and returned values are IB timeout multipliers + */ +static __inline uint8 +ComputeAckTimeout(IN uint8 pktLifeTime, IN uint8 caAckDelay) +{ + /* return TimeoutTimeToMult(TimeoutMultToTimeInUsec(pktLifeTime)*2 */ + /* + TimeoutMultToTimeInUsec(caAckDelay)); */ + /*return MIN(pktLifeTime + 2, 0x1f); */ + uint8 ackTimeout; + + /* tests also handle if remote endpoint didn't set REP.TargetAckDelay */ + if (pktLifeTime+1 >= caAckDelay) + { + /* since its a log2 value, +1 doubles the timeout */ + /* Additional +1 is to account for remote CA Ack delay */ + ackTimeout = pktLifeTime+2; + } else { + /* since caAckDelay > 2*pktLifetime, +1 simply doubles ca Ack Delay */ + ackTimeout = caAckDelay+1; + } + /* limit value to 5 bits (approx 2.4 hours) */ + if (ackTimeout > 0x1f) + ackTimeout = 0x1f; + return ackTimeout; +} + +#ifndef IB_STACK_OPENIB +/* helper function, converts a PATH_RECORD to an IB_ADDRESS_VECTOR to facilitate + * connection establishment and UD traffic + * PathMTU is an IB_MTU enum + */ +static __inline void +GetAVFromPath2( IN uint64 PortGuid, /* only needed for UD AVs */ + IN const IB_PATH_RECORD *pPathRecord, + OUT uint8* PathMTU OPTIONAL, + OUT IB_ADDRESS_VECTOR* DestAv OPTIONAL ) +{ + if (DestAv) + { + DestAv->PortGUID = PortGuid; /* only needed for UD AVs */ + DestAv->DestLID = pPathRecord->DLID; + DestAv->PathBits = (uint8)(pPathRecord->SLID&IB_PATHBITS_MASK); + DestAv->ServiceLevel = pPathRecord->u2.s.SL; + DestAv->StaticRate = pPathRecord->Rate; + + /* Global route information. */ + DestAv->GlobalRoute = IsGlobalRoute(pPathRecord); + DestAv->GlobalRouteInfo.DestGID = pPathRecord->DGID; + DestAv->GlobalRouteInfo.FlowLabel = pPathRecord->u1.s.FlowLabel; + DestAv->GlobalRouteInfo.HopLimit = (uint8)pPathRecord->u1.s.HopLimit; + DestAv->GlobalRouteInfo.SrcGIDIndex = 0; /* BUGBUG assume 0 */ + DestAv->GlobalRouteInfo.TrafficClass = pPathRecord->TClass; + } + + /* Reliable connection information, N/A for UD */ + if (PathMTU) + *PathMTU = pPathRecord->Mtu; +} + +/* This function is depricated, will be dropped in 3.1 release, + * use GetAVFromPath2 above + */ +static __inline void +GetAVFromPath( IN uint64 PortGuid, /* only needed for UD AVs */ + IN const IB_PATH_RECORD *pPathRecord, + OUT uint8* PathMTU OPTIONAL, OUT uint8* LocalAckTimeout OPTIONAL, + OUT IB_ADDRESS_VECTOR* DestAv OPTIONAL ) +{ + GetAVFromPath2(PortGuid, pPathRecord, PathMTU, DestAv); + if (LocalAckTimeout) + *LocalAckTimeout = ComputeAckTimeout(pPathRecord->PktLifeTime, + TimeoutTimeToMult(8)); /* guess: 8 ms */ +} + +/* helper function, converts a MCMEMBER_RECORD to an IB_ADDRESS_VECTOR to + * facilitate UD traffic + */ +static __inline void +GetAVFromMcMemberRecord(EUI64 PortGuid, + IB_MCMEMBER_RECORD *pMcMemberRecord, + IB_ADDRESS_VECTOR *pDestAv ) +{ + if (pDestAv != NULL) + { + pDestAv->PortGUID = pMcMemberRecord->RID.PortGID.Type.Global.InterfaceID; + pDestAv->DestLID = pMcMemberRecord->MLID; +/* pDestAv->PathBits = (uint8)pPathRecord->SLID; */ + pDestAv->PathBits = 0; + pDestAv->ServiceLevel = pMcMemberRecord->u1.s.SL; + pDestAv->StaticRate = pMcMemberRecord->Rate; + + /* Global route information. */ + pDestAv->GlobalRoute = TRUE; + pDestAv->GlobalRouteInfo.DestGID = pMcMemberRecord->RID.MGID; + pDestAv->GlobalRouteInfo.FlowLabel = pMcMemberRecord->u1.s.FlowLabel; + pDestAv->GlobalRouteInfo.HopLimit = (uint8)pMcMemberRecord->u1.s.HopLimit; + pDestAv->GlobalRouteInfo.SrcGIDIndex = 0; /* BUGBUG assume 0 */ + pDestAv->GlobalRouteInfo.TrafficClass = pMcMemberRecord->TClass; + } +} + +#endif /* IB_STACK_OPENIB */ + +#ifdef __cplusplus +} +#endif + +#endif /* _IBA_IB_SA_RECORDS_PRIV_H_ */ diff --git a/IbAccess/Common/Inc/ib_sd.h b/IbAccess/Common/Inc/ib_sd.h index 770c8a57..211b2625 100644 --- a/IbAccess/Common/Inc/ib_sd.h +++ b/IbAccess/Common/Inc/ib_sd.h @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT3 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-17, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -29,14 +29,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* [ICS VERSION STRING: unknown] */ -#if defined(CHECK_HEADERS) - -#ifndef __STL_SD_H__ -#warning FIX ME!!! Your includes should use the stl_sd.h header and not the ib_sd.h header for STL builds -#endif - -#endif - #ifndef _IBA_IB_SD_H_ #define _IBA_IB_SD_H_ @@ -57,21 +49,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * They can now be called directly. */ -#include #include -#include +#include #ifdef IB_STACK_OPENIB -#include +#include #else #if defined(VXWORKS) -#include +#include #ifdef BUILD_CM #include #endif - -#else -#include #endif #endif @@ -95,10 +83,10 @@ extern "C" { #define SD_DBG_ERROR 0x00000001 #define SD_DBG_INFO 0x00000002 #define SD_DBG_TRACE 0x00000004 -#define DBG_SILENT SD_DBG_SILENT/* DBG_SILENT is depricated */ -#define DBG_ERROR SD_DBG_ERROR /* DBG_ERROR is depricated*/ -#define DBG_INFO SD_DBG_INFO /* DBG_INFO is depricated */ -#define DBG_TRACE SD_DBG_TRACE /* DBG_TRACE is depricated*/ +#define DBG_SILENT SD_DBG_SILENT/* DBG_SILENT is deprecated */ +#define DBG_ERROR SD_DBG_ERROR /* DBG_ERROR is deprecated*/ +#define DBG_INFO SD_DBG_INFO /* DBG_INFO is deprecated */ +#define DBG_TRACE SD_DBG_TRACE /* DBG_TRACE is deprecated*/ typedef void *CLIENT_HANDLE; @@ -544,16 +532,6 @@ typedef struct _PORTINFO_RECORD_RESULTS { IB_PORTINFO_RECORD PortInfoRecords[1]; /* list of PortInfo records returned */ } PORTINFO_RECORD_RESULTS, *PPORTINFO_RECORD_RESULTS; -typedef struct _SMINFO_RECORD_RESULTS { - uint32 NumSMInfoRecords; /* Number of SmInfoRecords returned */ - IB_SMINFO_RECORD SMInfoRecords[1]; /* list of SMInfo records returned */ -} SMINFO_RECORD_RESULTS, *PSMINFO_RECORD_RESULTS; - -typedef struct _LINK_RECORD_RESULTS { - uint32 NumLinkRecords; /* Number of SmInfoRecords returned */ - IB_LINK_RECORD LinkRecords[1]; /* list of SMInfo records returned */ -} LINK_RECORD_RESULTS, *PLINK_RECORD_RESULTS; - typedef struct _NODEDESC_RESULTS { uint32 NumDescs; /* Number of NodeDescs returned */ NODE_DESCRIPTION NodeDescs[1]; /* NodeDesc, not \0 terminated */ @@ -574,46 +552,6 @@ typedef struct _INFORM_INFO_RECORD_RESULTS { IB_INFORM_INFO_RECORD InformInfoRecords[1];/* list of records returned */ } INFORM_INFO_RECORD_RESULTS, *PINFORM_INFO_RECORD_RESULTS; -typedef struct _TRACE_RECORD_RESULTS { - uint32 NumTraceRecords; /* Number of TraceRecords returned */ - IB_TRACE_RECORD TraceRecords[1]; /* list of trace records returned */ -} TRACE_RECORD_RESULTS, *PTRACE_RECORD_RESULTS; - -typedef struct _SWITCHINFO_RECORD_RESULTS { - uint32 NumSwitchInfoRecords; /* Number of SwitchInfoRecords returned */ - IB_SWITCHINFO_RECORD SwitchInfoRecords[1]; /* list of Switch Info records returned */ -} SWITCHINFO_RECORD_RESULTS, *PSWITCHINFO_RECORD_RESULTS; - -typedef struct _LINEAR_FDB_RECORD_RESULTS { - uint32 NumLinearFDBRecords; /* Number of LinearFDBRecords returned */ - IB_LINEAR_FDB_RECORD LinearFDBRecords[1]; /* list of Linear FDB records returned */ -} LINEAR_FDB_RECORD_RESULTS, *PLINEAR_FDB_RECORD_RESULTS; - -typedef struct _RANDOM_FDB_RECORD_RESULTS { - uint32 NumRandomFDBRecords; /* Number of RandomFDBRecords returned */ - IB_RANDOM_FDB_RECORD RandomFDBRecords[1]; /* list of Random FDB records returned */ -} RANDOM_FDB_RECORD_RESULTS, *PRANDOM_FDB_RECORD_RESULTS; - -typedef struct _MCAST_FDB_RECORD_RESULTS { - uint32 NumMCastFDBRecords; /* Number of MCastFDBRecords returned */ - IB_MCAST_FDB_RECORD MCastFDBRecords[1]; /* list of multicast FDB records returned */ -} MCAST_FDB_RECORD_RESULTS, *PMCAST_FDB_RECORD_RESULTS; - -typedef struct _VLARBTABLE_RECORD_RESULTS { - uint32 NumVLArbTableRecords; /* Number of VLArbTableRecords returned */ - IB_VLARBTABLE_RECORD VLArbTableRecords[1]; /* list of VL Arbitration table records returned */ -} VLARBTABLE_RECORD_RESULTS, *PVLARBTABLE_RECORD_RESULTS; - -typedef struct _PKEYTABLE_RECORD_RESULTS { - uint32 NumPKeyTableRecords; /* Number of PKeyTableRecords returned */ - IB_P_KEY_TABLE_RECORD PKeyTableRecords[1]; /* list of P-Key table records returned */ -} PKEYTABLE_RECORD_RESULTS, *PPKEYTABLE_RECORD_RESULTS; - -typedef struct _VF_RECORD_RESULTS { - uint32 NumVfInfoRecords; /* Number of VfInfoRecords returned */ - VEND_VFINFO_RECORD VfInfoRecords[1]; /* list of VF Info records returned */ -} VF_RECORD_RESULTS, *PVF_RECORD_RESULTS; - typedef struct _IB_CLASS_PORT_INFO_RESULTS { uint32 NumClassPortInfo; /* Number of records returned */ IB_CLASS_PORT_INFO ClassPortInfo[1]; /* list of records returned */ @@ -766,7 +704,7 @@ typedef IN IB_NOTICE *pNotice, /* IB_NOTICE record returned in the Report Request */ IN EUI64 PortGuid /* Port Guid from which Report Request was received */ ); -typedef SD_REPORT_NOTICE_CALLBACK *PREPORT_NOTICE_CALLBACK;/* depricated */ +typedef SD_REPORT_NOTICE_CALLBACK *PREPORT_NOTICE_CALLBACK;/* deprecated */ /* Callback made in kernel mode when a multicast group's state changes * this callback occurs in a thread context, however it should not preempt @@ -786,267 +724,7 @@ typedef IN MC_GROUP_STATE State, /* current state of multicast group */ IN IB_MCMEMBER_RECORD *pMcMemberRecord /* current member record settings */ ); -typedef SD_MULTICAST_CALLBACK *PMULTICAST_CALLBACK;/* depricated */ - - -/* =========================================================================== - * kernel mode function interface - */ -#if defined(VXWORKS) - -/* return a list of the PortGuids for presently active ports - * caller must MemoryDeallocate(*ppLocalPortGuidsList) when done using it - * this does not preempt - * if no ports are found, can return FSUCCESS but with both outputs set to 0 - * data pointed to only used during duration of call - */ -typedef FSTATUS - (SDK_GET_LOCAL_PORT_GUIDS)( - IN OUT uint64 **ppLocalPortGuidsList, - IN OUT uint32 *LocalPortGuidsCount - ); -IBA_API SDK_GET_LOCAL_PORT_GUIDS iba_sd_get_local_port_guids_alloc; - -/* return a list of the PortGuids and SubnetPrefixes for presently active ports - * caller must MemoryDeallocate(*ppLocalPortGuidsList) and - * MemoryDeallocate(*ppLocalPortSubnetPrefixList) when done using it - * this does not preempt - * if no ports are found, can return FSUCCESS but with both outputs set to 0 - * data pointed to only used during duration of call - */ -typedef FSTATUS - (SDK_GET_LOCAL_PORT_GUIDS2)( - IN OUT uint64 **ppLocalPortGuidsList, - IN OUT uint64 **ppLocalPortSubnetPrefixList, - IN OUT uint32 *LocalPortGuidsCount - ); -IBA_API SDK_GET_LOCAL_PORT_GUIDS2 iba_sd_get_local_port_guids_alloc2; - -/* Callback made in kernel mode when a Query[Port]FabricInformation completes - * this callback occurs in a thread context, however it should not preempt - * for long durations - * data pointed to only valid during duration of call - */ -typedef - void (SDK_QUERY_CALLBACK)( - IN void *Context, /* as supplied in Query */ - IN PQUERY pInputQuery, /* input request */ - IN PQUERY_RESULT_VALUES pQueryResults /* results returned from Manager */ - ); -typedef SDK_QUERY_CALLBACK *PQUERY_CALLBACK;/* depricated */ - -/* perform a query of a manager (SA, etc) - * using 1st active port - * if pQueryControlParameters is NULL, values established for client session - * will be used - * this function does not preempt. When the operation completes a callback - * will occur with the result data. - * data pointed to only used during duration of call - */ -typedef FSTATUS - (SDK_QUERY_FABRIC_INFO)( - IN CLIENT_HANDLE ClientHandle, - IN PQUERY pQuery, /* query to make */ - IN SDK_QUERY_CALLBACK *Callback, /* called on completion */ - IN COMMAND_CONTROL_PARAMETERS *pQueryControlParameters OPTIONAL, - IN void *Context OPTIONAL/* context for callback */ - ); -IBA_API SDK_QUERY_FABRIC_INFO iba_sd_query_fabric_info; - -/* Same as QueryFabricInformation, except issued against a specific port */ -typedef FSTATUS - (SDK_QUERY_PORT_FABRIC_INFO)( - IN CLIENT_HANDLE ClientHandle, - IN EUI64 PortGuid, - IN PQUERY pQuery, - IN SDK_QUERY_CALLBACK *Callback, - IN COMMAND_CONTROL_PARAMETERS *pQueryControlParameters OPTIONAL, - IN void *Context OPTIONAL - ); -IBA_API SDK_QUERY_PORT_FABRIC_INFO iba_sd_query_port_fabric_info; - -/* Callback made in kernel mode when a [Port]FabricOperation completes - * this callback occurs in a thread context, however it should not preempt - * for long durations - * data pointed to only valid during duration of call - */ -typedef - void (SDK_FABRIC_OPERATION_CALLBACK)( - IN void* Context,/* as supplied in FabricOperation */ - IN FABRIC_OPERATION_DATA* pFabOp, /* contains response value */ - IN FSTATUS Status, /* overall result of query */ - IN uint32 MadStatus /* for FSUCCESS or FERROR Status: */ - /* manager's Mad Status code from resp */ - ); -typedef SDK_FABRIC_OPERATION_CALLBACK *PFABRIC_OPERATION_CALLBACK;/* depricated */ - -/* perform a fabric operation (eg. set/delete, etc) against a manager - * using 1st active port - * if pCmdControlParameters is NULL, values established for client session - * will be used - * this function does not preempt. When the operation completes a callback - * will occur with the result data. - * data pointed to only used during duration of call - */ -typedef FSTATUS - (SDK_FABRIC_OPERATION)( - IN CLIENT_HANDLE ClientHandle, - IN FABRIC_OPERATION_DATA* pFabOp, /* operation to perform */ - IN SDK_FABRIC_OPERATION_CALLBACK *Callback, - IN COMMAND_CONTROL_PARAMETERS* pCmdControlParameters OPTIONAL, - IN void* Context OPTIONAL - ); -IBA_API SDK_FABRIC_OPERATION iba_sd_fabric_operation; - -/* Same as FabricOperation, except issued against a specific port */ -typedef FSTATUS - (SDK_PORT_FABRIC_OPERATION)( - IN CLIENT_HANDLE ClientHandle, - IN EUI64 PortGuid, - IN FABRIC_OPERATION_DATA* pFabOp, /* operation to perform */ - IN SDK_FABRIC_OPERATION_CALLBACK *Callback, - IN COMMAND_CONTROL_PARAMETERS* pCmdControlParameters OPTIONAL, - IN void* Context OPTIONAL - ); -IBA_API SDK_PORT_FABRIC_OPERATION iba_sd_port_fabric_operation; - -/* subscribe for an SA Trap/Notice - * client will receive a callback when the given Trap/Notice is received - */ -typedef FSTATUS - (SDK_TRAP_NOTICE_SUBSCRIBE)( - IN CLIENT_HANDLE ClientHandle, - IN uint16 TrapNumber, - IN EUI64 PortGuid, - IN void *pContext, - IN SD_REPORT_NOTICE_CALLBACK *pReportNoticeCallback - ); -IBA_API SDK_TRAP_NOTICE_SUBSCRIBE iba_sd_trap_notice_subscribe; - -/* unsubscribe for an SA Trap/Notice - * this does not preempt - */ -typedef FSTATUS - (SDK_TRAP_NOTICE_UNSUBSCRIBE)( - IN CLIENT_HANDLE ClientHandle, - IN uint16 TrapNumber, - IN EUI64 PortGuid - ); -IBA_API SDK_TRAP_NOTICE_UNSUBSCRIBE iba_sd_trap_notice_unsubscribe; - -/* have any of the client's traps been successfully subscribed for - * this does not preempt - */ -typedef boolean - (SDK_PORT_TRAPS_SUBSCRIBED)( - IN EUI64 PortGuid - ); -IBA_API SDK_PORT_TRAPS_SUBSCRIBED iba_sd_port_traps_subscribed; - -/* Request join/create of a multicast group - * - * This version of the call uses the MGID as the group identifier - * - * SdClientHandle - handle from iba_sd_register - * McFlags - MC_FLAGS_* to control when get callbacks - * ComponentMask - indicate fields in pMcMemberRecord which are set - * pContext - user defined context pointer supplied to callback - * pMulticastCallback - callback function invoked when join state changes - * - * Since joins are per HCA port, this call handles multiple applications - * joining the same MC group and will only issue joins to the SM on the - * 1st application joining. Similarly iba_sd_leave_mcgroup will only issue - * the leave to the SM on last application leaving. - * - * Internally this call maintains the joined state and will rejoin when - * fabric events warrent, such as SM restart, port down and up, etc. - * - * this does not preempt - * data pointed to only used during duration of call - */ -typedef FSTATUS - (SDK_JOIN_MULTICAST_GROUP)( - IN CLIENT_HANDLE SdClientHandle, - IN uint16 McFlags, - IN uint64 ComponentMask, - IN IB_MCMEMBER_RECORD *pMcMemberRecord, - IN void *pContext, - IN SD_MULTICAST_CALLBACK *pMulticastCallback - ); -IBA_API SDK_JOIN_MULTICAST_GROUP iba_sd_join_mcgroup; - -/* Request join/create of a multicast group - * - * This version of the call uses the RID as the group identifier - * - * SdClientHandle - handle from iba_sd_register - * McFlags - MC_FLAGS_* to control when get callbacks - * ComponentMask - indicate fields in pMcMemberRecord which are set - * pContext - user defined context pointer supplied to callback - * pMulticastCallback - callback function invoked when join state changes - * - * Since joins are per HCA port, this call handles multiple applications - * joining the same MC group and will only issue joins to the SM on the - * 1st application joining. Similarly iba_sd_leave_mcgroup2 will only issue - * the leave to the SM on last application leaving. - * - * Internally this call maintains the joined state and will rejoin when - * fabric events warrent, such as SM restart, port down and up, etc. - * - * this does not preempt - * data pointed to only used during duration of call - */ -typedef FSTATUS - (SDK_JOIN_MULTICAST_GROUP2)( - IN CLIENT_HANDLE SdClientHandle, - IN uint16 McFlags, - IN uint64 ComponentMask, - IN IB_MCMEMBER_RECORD *pMcMemberRecord, - IN EUI64 EgressPortGUID, - IN void *pContext, - IN SD_MULTICAST_CALLBACK *pMulticastCallback - ); -IBA_API SDK_JOIN_MULTICAST_GROUP2 iba_sd_join_mcgroup2; - -/* Request leave of a multicast group which was previously joined via - * iba_sd_join_mcgroup - * - * Once this returns, no more callbacks will be issued for the given join. - * This call does not trigger a callback. - * - * This will only issue the leave to the SM on last application leaving the - * group. - * - * this does not preempt - */ -typedef FSTATUS - (SDK_LEAVE_MULTICAST_GROUP)( - IN CLIENT_HANDLE SdClientHandle, - IN IB_GID *pMGID - ); -IBA_API SDK_LEAVE_MULTICAST_GROUP iba_sd_leave_mcgroup; - -/* Request leave of a multicast group which was previously joined via - * iba_sd_join_mcgroup2 - * - * Once this returns, no more callbacks will be issued for the given join. - * This call does not trigger a callback. - * - * This will only issue the leave to the SM on last application leaving the - * group. - * - * this does not preempt - */ -typedef FSTATUS - (SDK_LEAVE_MULTICAST_GROUP2)( - IN CLIENT_HANDLE SdClientHandle, - IN IB_GID *pMGID, - IN IB_GID *pPortGID, - IN EUI64 EgressPortGUID - ); -IBA_API SDK_LEAVE_MULTICAST_GROUP2 iba_sd_leave_mcgroup2; - -#endif /* defined(VXWORKS) */ +typedef SD_MULTICAST_CALLBACK *PMULTICAST_CALLBACK;/* deprecated */ #ifdef __cplusplus }; diff --git a/IbAccess/Common/Inc/ib_sd_priv.h b/IbAccess/Common/Inc/ib_sd_priv.h new file mode 100644 index 00000000..a1efa5fc --- /dev/null +++ b/IbAccess/Common/Inc/ib_sd_priv.h @@ -0,0 +1,366 @@ +/* BEGIN_ICS_COPYRIGHT3 **************************************** + +Copyright (c) 2015-17, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +** END_ICS_COPYRIGHT3 ****************************************/ + +/* [ICS VERSION STRING: unknown] */ + +#ifndef _IBA_IB_SD_PRIV_H_ +#define _IBA_IB_SD_PRIV_H_ + +/* IB Subnet Data Interface + * The subnet data interface provides a simplied interface to the SM/SA and + * automates queries, sets and deletes for commonly required information + * from the SM/SA. + * + * The subnet data interface automatically handles the following: + * - retries (client configurable) + * - timeouts (client configurable) + * - RMPP response coallessing and inter-record padding + * - extraction of selected fields from a query to provide a concise response + * to client + * - multi-tiered queries (get paths to a node, etc) + * + * New drivers/applications should use the iba_* functions. + * They can now be called directly. + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _SMINFO_RECORD_RESULTS { + uint32 NumSMInfoRecords; /* Number of SmInfoRecords returned */ + IB_SMINFO_RECORD SMInfoRecords[1]; /* list of SMInfo records returned */ +} SMINFO_RECORD_RESULTS, *PSMINFO_RECORD_RESULTS; + +typedef struct _LINK_RECORD_RESULTS { + uint32 NumLinkRecords; /* Number of SmInfoRecords returned */ + IB_LINK_RECORD LinkRecords[1]; /* list of SMInfo records returned */ +} LINK_RECORD_RESULTS, *PLINK_RECORD_RESULTS; + +typedef struct _TRACE_RECORD_RESULTS { + uint32 NumTraceRecords; /* Number of TraceRecords returned */ + IB_TRACE_RECORD TraceRecords[1]; /* list of trace records returned */ +} TRACE_RECORD_RESULTS, *PTRACE_RECORD_RESULTS; + +typedef struct _SWITCHINFO_RECORD_RESULTS { + uint32 NumSwitchInfoRecords; /* Number of SwitchInfoRecords returned */ + IB_SWITCHINFO_RECORD SwitchInfoRecords[1]; /* list of Switch Info records returned */ +} SWITCHINFO_RECORD_RESULTS, *PSWITCHINFO_RECORD_RESULTS; + +typedef struct _LINEAR_FDB_RECORD_RESULTS { + uint32 NumLinearFDBRecords; /* Number of LinearFDBRecords returned */ + IB_LINEAR_FDB_RECORD LinearFDBRecords[1]; /* list of Linear FDB records returned */ +} LINEAR_FDB_RECORD_RESULTS, *PLINEAR_FDB_RECORD_RESULTS; + +typedef struct _RANDOM_FDB_RECORD_RESULTS { + uint32 NumRandomFDBRecords; /* Number of RandomFDBRecords returned */ + IB_RANDOM_FDB_RECORD RandomFDBRecords[1]; /* list of Random FDB records returned */ +} RANDOM_FDB_RECORD_RESULTS, *PRANDOM_FDB_RECORD_RESULTS; + +typedef struct _MCAST_FDB_RECORD_RESULTS { + uint32 NumMCastFDBRecords; /* Number of MCastFDBRecords returned */ + IB_MCAST_FDB_RECORD MCastFDBRecords[1]; /* list of multicast FDB records returned */ +} MCAST_FDB_RECORD_RESULTS, *PMCAST_FDB_RECORD_RESULTS; + +typedef struct _VLARBTABLE_RECORD_RESULTS { + uint32 NumVLArbTableRecords; /* Number of VLArbTableRecords returned */ + IB_VLARBTABLE_RECORD VLArbTableRecords[1]; /* list of VL Arbitration table records returned */ +} VLARBTABLE_RECORD_RESULTS, *PVLARBTABLE_RECORD_RESULTS; + +typedef struct _PKEYTABLE_RECORD_RESULTS { + uint32 NumPKeyTableRecords; /* Number of PKeyTableRecords returned */ + IB_P_KEY_TABLE_RECORD PKeyTableRecords[1]; /* list of P-Key table records returned */ +} PKEYTABLE_RECORD_RESULTS, *PPKEYTABLE_RECORD_RESULTS; + +/* =========================================================================== + * kernel mode function interface + */ +#if defined(VXWORKS) + +/* return a list of the PortGuids for presently active ports + * caller must MemoryDeallocate(*ppLocalPortGuidsList) when done using it + * this does not preempt + * if no ports are found, can return FSUCCESS but with both outputs set to 0 + * data pointed to only used during duration of call + */ +typedef FSTATUS + (SDK_GET_LOCAL_PORT_GUIDS)( + IN OUT uint64 **ppLocalPortGuidsList, + IN OUT uint32 *LocalPortGuidsCount + ); +IBA_API SDK_GET_LOCAL_PORT_GUIDS iba_sd_get_local_port_guids_alloc; + +/* return a list of the PortGuids and SubnetPrefixes for presently active ports + * caller must MemoryDeallocate(*ppLocalPortGuidsList) and + * MemoryDeallocate(*ppLocalPortSubnetPrefixList) when done using it + * this does not preempt + * if no ports are found, can return FSUCCESS but with both outputs set to 0 + * data pointed to only used during duration of call + */ +typedef FSTATUS + (SDK_GET_LOCAL_PORT_GUIDS2)( + IN OUT uint64 **ppLocalPortGuidsList, + IN OUT uint64 **ppLocalPortSubnetPrefixList, + IN OUT uint32 *LocalPortGuidsCount + ); +IBA_API SDK_GET_LOCAL_PORT_GUIDS2 iba_sd_get_local_port_guids_alloc2; + +/* Callback made in kernel mode when a Query[Port]FabricInformation completes + * this callback occurs in a thread context, however it should not preempt + * for long durations + * data pointed to only valid during duration of call + */ +typedef + void (SDK_QUERY_CALLBACK)( + IN void *Context, /* as supplied in Query */ + IN PQUERY pInputQuery, /* input request */ + IN PQUERY_RESULT_VALUES pQueryResults /* results returned from Manager */ + ); +typedef SDK_QUERY_CALLBACK *PQUERY_CALLBACK;/* depricated */ + +/* perform a query of a manager (SA, etc) + * using 1st active port + * if pQueryControlParameters is NULL, values established for client session + * will be used + * this function does not preempt. When the operation completes a callback + * will occur with the result data. + * data pointed to only used during duration of call + */ +typedef FSTATUS + (SDK_QUERY_FABRIC_INFO)( + IN CLIENT_HANDLE ClientHandle, + IN PQUERY pQuery, /* query to make */ + IN SDK_QUERY_CALLBACK *Callback, /* called on completion */ + IN COMMAND_CONTROL_PARAMETERS *pQueryControlParameters OPTIONAL, + IN void *Context OPTIONAL/* context for callback */ + ); +IBA_API SDK_QUERY_FABRIC_INFO iba_sd_query_fabric_info; + +/* Same as QueryFabricInformation, except issued against a specific port */ +typedef FSTATUS + (SDK_QUERY_PORT_FABRIC_INFO)( + IN CLIENT_HANDLE ClientHandle, + IN EUI64 PortGuid, + IN PQUERY pQuery, + IN SDK_QUERY_CALLBACK *Callback, + IN COMMAND_CONTROL_PARAMETERS *pQueryControlParameters OPTIONAL, + IN void *Context OPTIONAL + ); +IBA_API SDK_QUERY_PORT_FABRIC_INFO iba_sd_query_port_fabric_info; + +/* Callback made in kernel mode when a [Port]FabricOperation completes + * this callback occurs in a thread context, however it should not preempt + * for long durations + * data pointed to only valid during duration of call + */ +typedef + void (SDK_FABRIC_OPERATION_CALLBACK)( + IN void* Context,/* as supplied in FabricOperation */ + IN FABRIC_OPERATION_DATA* pFabOp, /* contains response value */ + IN FSTATUS Status, /* overall result of query */ + IN uint32 MadStatus /* for FSUCCESS or FERROR Status: */ + /* manager's Mad Status code from resp */ + ); +typedef SDK_FABRIC_OPERATION_CALLBACK *PFABRIC_OPERATION_CALLBACK;/* depricated */ + +/* perform a fabric operation (eg. set/delete, etc) against a manager + * using 1st active port + * if pCmdControlParameters is NULL, values established for client session + * will be used + * this function does not preempt. When the operation completes a callback + * will occur with the result data. + * data pointed to only used during duration of call + */ +typedef FSTATUS + (SDK_FABRIC_OPERATION)( + IN CLIENT_HANDLE ClientHandle, + IN FABRIC_OPERATION_DATA* pFabOp, /* operation to perform */ + IN SDK_FABRIC_OPERATION_CALLBACK *Callback, + IN COMMAND_CONTROL_PARAMETERS* pCmdControlParameters OPTIONAL, + IN void* Context OPTIONAL + ); +IBA_API SDK_FABRIC_OPERATION iba_sd_fabric_operation; + +/* Same as FabricOperation, except issued against a specific port */ +typedef FSTATUS + (SDK_PORT_FABRIC_OPERATION)( + IN CLIENT_HANDLE ClientHandle, + IN EUI64 PortGuid, + IN FABRIC_OPERATION_DATA* pFabOp, /* operation to perform */ + IN SDK_FABRIC_OPERATION_CALLBACK *Callback, + IN COMMAND_CONTROL_PARAMETERS* pCmdControlParameters OPTIONAL, + IN void* Context OPTIONAL + ); +IBA_API SDK_PORT_FABRIC_OPERATION iba_sd_port_fabric_operation; + +/* subscribe for an SA Trap/Notice + * client will receive a callback when the given Trap/Notice is received + */ +typedef FSTATUS + (SDK_TRAP_NOTICE_SUBSCRIBE)( + IN CLIENT_HANDLE ClientHandle, + IN uint16 TrapNumber, + IN EUI64 PortGuid, + IN void *pContext, + IN SD_REPORT_NOTICE_CALLBACK *pReportNoticeCallback + ); +IBA_API SDK_TRAP_NOTICE_SUBSCRIBE iba_sd_trap_notice_subscribe; + +/* unsubscribe for an SA Trap/Notice + * this does not preempt + */ +typedef FSTATUS + (SDK_TRAP_NOTICE_UNSUBSCRIBE)( + IN CLIENT_HANDLE ClientHandle, + IN uint16 TrapNumber, + IN EUI64 PortGuid + ); +IBA_API SDK_TRAP_NOTICE_UNSUBSCRIBE iba_sd_trap_notice_unsubscribe; + +/* have any of the client's traps been successfully subscribed for + * this does not preempt + */ +typedef boolean + (SDK_PORT_TRAPS_SUBSCRIBED)( + IN EUI64 PortGuid + ); +IBA_API SDK_PORT_TRAPS_SUBSCRIBED iba_sd_port_traps_subscribed; + +/* Request join/create of a multicast group + * + * This version of the call uses the MGID as the group identifier + * + * SdClientHandle - handle from iba_sd_register + * McFlags - MC_FLAGS_* to control when get callbacks + * ComponentMask - indicate fields in pMcMemberRecord which are set + * pContext - user defined context pointer supplied to callback + * pMulticastCallback - callback function invoked when join state changes + * + * Since joins are per HCA port, this call handles multiple applications + * joining the same MC group and will only issue joins to the SM on the + * 1st application joining. Similarly iba_sd_leave_mcgroup will only issue + * the leave to the SM on last application leaving. + * + * Internally this call maintains the joined state and will rejoin when + * fabric events warrent, such as SM restart, port down and up, etc. + * + * this does not preempt + * data pointed to only used during duration of call + */ +typedef FSTATUS + (SDK_JOIN_MULTICAST_GROUP)( + IN CLIENT_HANDLE SdClientHandle, + IN uint16 McFlags, + IN uint64 ComponentMask, + IN IB_MCMEMBER_RECORD *pMcMemberRecord, + IN void *pContext, + IN SD_MULTICAST_CALLBACK *pMulticastCallback + ); +IBA_API SDK_JOIN_MULTICAST_GROUP iba_sd_join_mcgroup; + +/* Request join/create of a multicast group + * + * This version of the call uses the RID as the group identifier + * + * SdClientHandle - handle from iba_sd_register + * McFlags - MC_FLAGS_* to control when get callbacks + * ComponentMask - indicate fields in pMcMemberRecord which are set + * pContext - user defined context pointer supplied to callback + * pMulticastCallback - callback function invoked when join state changes + * + * Since joins are per HCA port, this call handles multiple applications + * joining the same MC group and will only issue joins to the SM on the + * 1st application joining. Similarly iba_sd_leave_mcgroup2 will only issue + * the leave to the SM on last application leaving. + * + * Internally this call maintains the joined state and will rejoin when + * fabric events warrent, such as SM restart, port down and up, etc. + * + * this does not preempt + * data pointed to only used during duration of call + */ +typedef FSTATUS + (SDK_JOIN_MULTICAST_GROUP2)( + IN CLIENT_HANDLE SdClientHandle, + IN uint16 McFlags, + IN uint64 ComponentMask, + IN IB_MCMEMBER_RECORD *pMcMemberRecord, + IN EUI64 EgressPortGUID, + IN void *pContext, + IN SD_MULTICAST_CALLBACK *pMulticastCallback + ); +IBA_API SDK_JOIN_MULTICAST_GROUP2 iba_sd_join_mcgroup2; + +/* Request leave of a multicast group which was previously joined via + * iba_sd_join_mcgroup + * + * Once this returns, no more callbacks will be issued for the given join. + * This call does not trigger a callback. + * + * This will only issue the leave to the SM on last application leaving the + * group. + * + * this does not preempt + */ +typedef FSTATUS + (SDK_LEAVE_MULTICAST_GROUP)( + IN CLIENT_HANDLE SdClientHandle, + IN IB_GID *pMGID + ); +IBA_API SDK_LEAVE_MULTICAST_GROUP iba_sd_leave_mcgroup; + +/* Request leave of a multicast group which was previously joined via + * iba_sd_join_mcgroup2 + * + * Once this returns, no more callbacks will be issued for the given join. + * This call does not trigger a callback. + * + * This will only issue the leave to the SM on last application leaving the + * group. + * + * this does not preempt + */ +typedef FSTATUS + (SDK_LEAVE_MULTICAST_GROUP2)( + IN CLIENT_HANDLE SdClientHandle, + IN IB_GID *pMGID, + IN IB_GID *pPortGID, + IN EUI64 EgressPortGUID + ); +IBA_API SDK_LEAVE_MULTICAST_GROUP2 iba_sd_leave_mcgroup2; + +#endif /* defined(VXWORKS) */ + +#ifdef __cplusplus +}; +#endif + +#endif /* _IBA_IB_SD_PRIV_H_ */ diff --git a/IbAccess/Common/Inc/ib_sm.h b/IbAccess/Common/Inc/ib_sm.h deleted file mode 100644 index 863081fe..00000000 --- a/IbAccess/Common/Inc/ib_sm.h +++ /dev/null @@ -1,1562 +0,0 @@ -/* BEGIN_ICS_COPYRIGHT3 **************************************** - -Copyright (c) 2015, Intel Corporation - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of Intel Corporation nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -** END_ICS_COPYRIGHT3 ****************************************/ - -/* [ICS VERSION STRING: unknown] */ - -#if defined(CHECK_HEADERS) - -#ifndef __IBA_STL_SM_H__ -#warning FIX ME!!! Your includes should use the stl_sm.h header and not the ib_sm.h header for STL builds -#endif - -#endif - -#ifndef __IBA_IB_SM_H__ -#define __IBA_IB_SM_H__ - -#include "iba/public/datatypes.h" -#include "iba/vpi.h" -#include "iba/stl_mad.h" -#include "iba/public/ibyteswap.h" - -// CPU_LE code below can't get to uint typedef -#if defined(VXWORKS) -typedef unsigned int uint; -#endif - -#if defined (__cplusplus) -extern "C" { -#endif - -#include "iba/public/ipackon.h" - -/* - * Defines - */ - -#define IB_SM_CLASS_VERSION 1 /* Subnet Management */ - -/* SMP Attributes */ -#define MCLASS_ATTRIB_ID_NODE_DESCRIPTION 0x0010 /* Node description string */ -#define MCLASS_ATTRIB_ID_NODE_INFO 0x0011 /* Generic node data */ -#define MCLASS_ATTRIB_ID_SWITCH_INFO 0x0012 /* Switch information */ -/* 0x0013 reserved (was RouterInfo) */ -#define MCLASS_ATTRIB_ID_GUID_INFO 0x0014 /* Assigned GIDs */ -#define MCLASS_ATTRIB_ID_PORT_INFO 0x0015 /* Port Information */ -#define MCLASS_ATTRIB_ID_PART_TABLE 0x0016 /* Partition Table */ - -#define MCLASS_ATTRIB_ID_SL_VL_MAPPING_TABLE 0x0017 /* Service level to */ - /* Virtual Lane mapping info */ -#define MCLASS_ATTRIB_ID_VL_ARBITRATION 0x0018 /* List of weights */ -#define MCLASS_ATTRIB_ID_LINEAR_FWD_TABLE 0x0019 /* Linear forwarding table */ -#define MCLASS_ATTRIB_ID_RANDOM_FWD_TABLE 0x001A /* Random forwarding */ - /* database information */ -#define MCLASS_ATTRIB_ID_MCAST_FWD_TABLE 0x001B /* Multicast forwarding */ - /* database information */ - -#define MCLASS_ATTRIB_ID_SM_INFO 0x0020 /* Subnet Manager */ - /* Information */ -/* 0x0021 reserved - was RoutingInfo */ -#define MCLASS_ATTRIB_ID_VENDOR_DIAG 0x0030 /* Vendor specific */ - /* Diagnostic */ -#define MCLASS_ATTRIB_ID_LED_INFO 0x0031 /* Turn on/off LED */ - -#define MCLASS_ATTRIB_ID_PORT_LFT 0xff19 /* Port Linear forwarding table */ -#define MCLASS_ATTRIB_ID_PORT_GROUP 0xff21 /* Vendor Port Group Info */ -#define MCLASS_ATTRIB_ID_AR_LIDMASK 0xff22 /* LID Mask for Adaptive Routing */ - -#define MCLASS_ATTRIB_ID_ICS_LED_INFO 0xff31 /* Turn on/off/auto LED */ - -#define MCLASS_ATTRIB_ID_COLLECTIVE_NOTICE 0xff40 /* Vendor unique collective notice */ -#define MCLASS_ATTRIB_ID_CMLIST 0xff41 /* Vendor unique collective multicast list */ -#define MCLASS_ATTRIB_ID_CFT 0xff42 /* Vendor unique collective forwarding table */ - -/* SMP Attribute Modifiers */ -#define MCLASS_ATTRIB_MOD_SUPPORTS_EXT_SPEEDS 0x80000000 /* SMSupportsExtendedLinkSpeeds */ - -/* ************************************************************************* - * SMPs - */ - -/* SMP Fields (LID Routed/Directed Route) */ -typedef struct _SMP { - - MAD_COMMON common; - uint64 M_Key; /* A 64 bit key, */ - /* employed for SM authentication */ - union { - struct _LIDRouted - { - uint8 Reserved3[32]; /* For aligning the SMP data field with */ - /* the directed route SMP data field */ - uint8 SMPData[64]; /* 64 byte field of SMP data used to */ - /* contain the methods attribute */ - uint8 Reserved4[128]; /* Reserved. Shall be set to 0 */ - } LIDRouted; - - struct _DirectedRoute - { - uint16 DrSLID; /* Directed route source LID */ - uint16 DrDLID; /* Directed route destination LID */ - uint8 Reserved2[28]; /* For the purpose of aligning the Data */ - /* field on a 64 byte boundary */ - - uint8 SMPData[64]; /* 64-byte field of SMP data used to */ - /* contain the methods attribute */ - uint8 InitPath[64]; /* 64-byte field containing the initial */ - /* directed path */ - uint8 RetPath[64]; /* 64-byte field containing the */ - /* returning directed path */ - } DirectedRoute; - }SmpExt; - -} PACK_SUFFIX SMP; - -#if 0 -#define SMP_SET_VERSION_INFO(smp, basever, mgmtcl, clver) {\ - MAD_SET_VERSION_INFO(smp, basever, mgmtcl, clver); \ -} - -#define SMP_GET_VERSION_INFO(smp, basever, mgmtcl, clver) {\ - MAD_GET_VERSION_INFO(smp, basever, mgmtcl, clver); \ -} -#endif - -#define SMP_GET_STATUS(smp, status) {\ - MAD_GET_STATUS(smp, status); \ -} - -#define SMP_GET_DR_STATUS(smp, status, d) { \ - (*status) = (smp)->common.u.DR.s.Status; \ - if( NULL != d){\ - (*d) = (smp)->common.u.DR.s.D; \ - }\ -} - -#define SMP_SET_HOP_POINTER(smp, hop_ptr) { \ - (smp)->common.u.DR.HopPointer = hop_ptr; \ -} - -#define SMP_GET_HOP_POINTER(smp, hop_ptr) { \ - (*hop_ptr) = (smp)->common.u.DR.HopPointer; \ -} - -#define SMP_SET_HOP_COUNT(smp, hop_count) { \ - (smp)->common.u.DR.HopCount = hop_count; \ -} - -#define SMP_GET_HOP_COUNT(smp, hop_count) { \ - (*hop_count) = (x)->common.u.DR.HopCount; \ -} - -#define SMP_SET_TRANSACTION_ID(smp, id) {\ - MAD_SET_TRANSACTION_ID(smp, id); \ -} - -#define SMP_GET_TRANSACTION_ID(smp, id) {\ - MAD_GET_TRANSACTION_ID(smp, id); \ -} - -#define SMP_SET_ATTRIB_ID(smp, id) {\ - MAD_SET_ATTRIB_ID(smp, id); \ -} - -#define SMP_GET_ATTRIB_ID(smp, id) {\ - MAD_GET_ATTRIB_ID(smp, id); \ -} - -#define SMP_SET_ATTRIB_MOD(smp, amod) {\ - MAD_SET_ATTRIB_MOD(smp, amod); \ -} - -#define SMP_GET_ATTRIB_MOD(smp, amod) {\ - MAD_GET_ATTRIB_MOD(smp, amod); \ -} - -#define SMP_SET_M_KEY(smp, mkey) {\ - (smp)->M_Key = mkey; \ -} - -#define SMP_GET_M_KEY(smp, mkey) {\ - (mkey) = (smp)->M_Key; \ -} - -#define SMP_LR_DATA SmpExt.LIDRouted.SMPData - -#define SMP_DR_DLID SmpExt.DirectedRoute.DrDLID -#define SMP_DR_SLID SmpExt.DirectedRoute.DrSLID -#define SMP_DR_DATA SmpExt.DirectedRoute.SMPData -#define SMP_DR_IPath SmpExt.DirectedRoute.InitPath -#define SMP_DR_RPath SmpExt.DirectedRoute.RetPath - - -/* ************************************************************************** - * Attribute specific SMP Packet Formats - */ - -/* - * SMA Notices/Traps (Data field for IB_NOTICE, see ib_mad.h) - */ - - /* Trap Numbers */ -#define SMA_TRAP_GID_NOW_IN_SERVICE 64 /* is now in service */ -#define SMA_TRAP_GID_OUT_OF_SERVICE 65 /* is out of service */ -#define SMA_TRAP_ADD_MULTICAST_GROUP 66 /* New multicast group with multicast address is now created */ -#define SMA_TRAP_DEL_MULTICAST_GROUP 67 /* New multicast group with multicast address is now deleted */ -#define SMA_TRAP_LINK_STATE 128 /* Switch port link state has changed */ -#define SMA_TRAP_LINK_INTEGRITY 129 /* Any link integrity threshold reached */ -#define SMA_TRAP_BUFFER_OVERRUN 130 /* Any buffer overrun threshold reached */ -#define SMA_TRAP_FLOW_WATCHDOG 131 /* Switch flow control update watchdog */ -#define SMA_TRAP_CHG_CAPABILITY 144 /* capability mask changed */ -#define SMA_TRAP_CHG_PLATGUID 145 /* platform (system) guid changed */ -#define SMA_TRAP_BAD_MKEY 256 /* Any bad M_key */ -#define SMA_TRAP_BAD_PKEY 257 /* Any bad P_key */ -#define SMA_TRAP_BAD_QKEY 258 /* Any bad Q_key */ -#define SMA_TRAP_SWITCH_BAD_PKEY 259 /* Switch bad P_key */ - -/* Link state of at least one port of switch at has changed */ -typedef struct _SMA_TRAP_DATA_LINK_STATE { - uint16 ReportingLID; -} PACK_SUFFIX SMA_TRAP_DATA_LINK_STATE; - -/* Local link integrity threshold reached at */ -typedef struct _SMA_TRAP_DATA_LINK_INTEGRITY { - uint16 Reserved0; - uint16 ReportingLID; - uint8 LocalPortNum; /* port with error */ -} PACK_SUFFIX SMA_TRAP_DATA_LINK_INTEGRITY; - -/* Excessive Buffer Overrun threshold reached at */ -typedef struct _SMA_TRAP_DATA_BUFFER_OVERRUN { - uint16 Reserved0; - uint16 ReportingLID; - uint8 LocalPortNum; /* port with error */ -} PACK_SUFFIX SMA_TRAP_DATA_BUFFER_OVERRUN; - -/* Flow Control Update Watchdog timer expired at */ -typedef struct _SMA_TRAP_DATA_FLOW_WATCHDOG { - uint16 Reserved0; - uint16 ReportingLID; - uint8 LocalPortNum; /* port with timeout */ -} PACK_SUFFIX SMA_TRAP_DATA_FLOW_WATCHDOG; - -/* bad M_Key, from attempted - * with and < AttributeModifier> - */ -typedef struct _SMA_TRAP_DATA_BAD_MKEY { - uint16 Reserved0; - uint16 RequestorLID; /* LID which attempted access */ - uint16 Reserved1; - uint8 Method; - uint8 Reserved2; - uint16 AttributeID; - uint32 AttributeModifier; - uint64 M_Key; /* The 8-byte management key. */ -} PACK_SUFFIX SMA_TRAP_DATA_BAD_MKEY; - -/* bad P_Key, from // - * to // on - */ -typedef struct _SMA_TRAP_DATA_BAD_PKEY { - uint16 Reserved0; - uint16 SenderLID; /* LID1 */ - uint16 ReceiverLID; /* LID2 */ - uint16 Reserved; - uint16 P_Key; - union { - uint32 AsReg32; - - struct { -#if CPU_BE - uint32 SL: 4; - uint32 Reserved2: 4; - uint32 SenderQP: 24; -#else - uint32 SenderQP: 24; - uint32 Reserved2: 4; - uint32 SL: 4; -#endif - } s; - } u1; - union { - uint32 AsReg32; - - struct { -#if CPU_BE - uint32 Reserved3: 8; - uint32 ReceiverQP: 24; -#else - uint32 ReceiverQP: 24; - uint32 Reserved3: 8; -#endif - } s; - } u2; - IB_GID SenderGID; - IB_GID ReceiverGID; -} PACK_SUFFIX SMA_TRAP_DATA_BAD_PKEY; - -/* bad Q_Key, from // - * to // on - */ -typedef struct _SMA_TRAP_DATA_BAD_QKEY { - uint16 Reserved0; - uint16 SenderLID; - uint16 ReceiverLID; - uint32 Q_Key; - union { - uint32 AsReg32; - - struct { -#if CPU_BE - uint32 SL: 4; - uint32 Reserved2: 4; - uint32 SenderQP: 24; -#else - uint32 SenderQP: 24; - uint32 Reserved2: 4; - uint32 SL: 4; -#endif - } s; - } u1; - union { - uint32 AsReg32; - - struct { -#if CPU_BE - uint32 Reserved3: 8; - uint32 ReceiverQP: 24; -#else - uint32 ReceiverQP: 24; - uint32 Reserved3: 8; -#endif - } s; - } u2; - IB_GID SenderGID; - IB_GID ReceiverGID; -} PACK_SUFFIX SMA_TRAP_DATA_BAD_QKEY; - - -/* - * NodeInfo - */ - -#define OUI_TRUESCALE 0x00066a - - -typedef struct _NODE_INFO { - - uint8 BaseVersion; /* Supported MAD Base Version. */ - uint8 ClassVersion; /* Supported Subnet Management Class */ - /* (SMP) Version. */ - uint8 NodeType; - uint8 NumPorts; /* Number of link ports on this node. */ - - /* note GUIDs on 4 byte boundary */ - uint64 SystemImageGUID; - - uint64 NodeGUID; /* GUID of the HCA, TCA, switch, */ - /* or router itself. */ - uint64 PortGUID; /* GUID of this end port itself. */ - - uint16 PartitionCap; /* Number of entries in the Partition Table */ - /* for end ports. */ - uint16 DeviceID; /* Device ID information as assigned by */ - /* device manufacturer. */ - uint32 Revision; /* Device revision, assigned by manufacturer. */ - - union { - uint32 AsReg32; - - struct { -#if CPU_BE - uint32 LocalPortNum: 8; /* The link port number this */ - uint32 VendorID: 24; /* Device vendor, per IEEE. */ -#else - uint32 VendorID: 24; /* Device vendor, per IEEE. */ - uint32 LocalPortNum: 8; /* The link port number this */ - /* SMP came on in. */ -#endif - } s; - } u1; - -} PACK_SUFFIX NODE_INFO; - - -/* - * NodeDescription - */ - -#define NODE_DESCRIPTION_ARRAY_SIZE 64 - -typedef struct _NODE_DESCRIPTION { - - /* Node String is an array of UTF-8 character that */ - /* describes the node in text format */ - /* Note that this string is NOT NULL TERMINATED! */ - uint8 NodeString[NODE_DESCRIPTION_ARRAY_SIZE]; - -} PACK_SUFFIX NODE_DESCRIPTION; - - - -/* VendorDiags - * TBD - */ - - -/* - * SwitchInfo - */ -typedef struct _SWITCH_INFO { - uint16 LinearFDBCap; /* Number of entries supported in the */ - /* Linear Unicast Forwarding Database */ - uint16 RandomFDBCap; /* Number of entries supported in the */ - /* Random Unicast Forwarding Database. */ - uint16 MulticastFDBCap; /* Number of entries supported in the */ - /* Multicast Forwarding Database */ - uint16 LinearFDBTop; /* Indicates the top of the linear */ - /* forwarding table. */ - uint8 DefaultPort; /* forward to this port all unicast */ - /* packets from other ports */ - /* whose DLID does not exist in the random */ - /* fwd table */ - uint8 DefaultMulticastPrimaryPort; - uint8 DefaultMulticastNotPrimaryPort; - union { - uint8 AsReg8; - struct { -#if CPU_BE - uint8 LifeTimeValue: 5; - uint8 PortStateChange: 1; - uint8 OptimizedSLVL: 2; -#else - uint8 OptimizedSLVL: 2; - uint8 PortStateChange:1; /* This bit is set to zero by a */ - /* management write. */ - uint8 LifeTimeValue: 5; /* Sets the time a packet can live in */ - /* the switch. See section XXX */ -#endif - } s; - } u1; - uint16 LIDsPerPort; /* specifies no. of LID/LMC combinations */ - /* that may be assigned */ - /* to a given link port for switches that */ - /* support the Random Forwarding database */ - /* model */ - uint16 PartitionEnforcementCap;/* Specifies the number of entries in the */ - /* partition enforcement table. */ - union { - uint8 AsReg8; - struct { -#if CPU_BE - uint8 InboundEnforcementCapable: 1; - uint8 OutboundEnforcementCapable: 1; - uint8 FilterRawPacketInboundCapable: 1; - uint8 FilterRawPacketOutboundCapable: 1; - uint8 EnhancedPort0: 1; - uint8 reserved: 3; -#else - uint8 reserved: 3; - uint8 EnhancedPort0: 1; - uint8 FilterRawPacketOutboundCapable: 1; - uint8 FilterRawPacketInboundCapable: 1; - uint8 OutboundEnforcementCapable: 1; - uint8 InboundEnforcementCapable: 1; -#endif /*CPU_BE */ - } s; - } u2; - - uint8 Reserved2; - - uint16 MulticastFDBTop; /* Indicates the top of the multicast */ - /* forwarding table. */ -} PACK_SUFFIX SWITCH_INFO; - - -/* - * GuidInfo - */ - -/* The GuidInfo Attribute allows the setting of GUIDs to an end port. */ -#define GUID_INFO_BLOCK_SIZE 8 -#define GUID_INFO_MAX_BLOCK_NUM 31 - -typedef struct _GUID_INFO { - /* Gid 0 in block 0 is Read only invariant value of the BASE GUID */ - uint64 Gid[GUID_INFO_BLOCK_SIZE]; -} PACK_SUFFIX GUID_INFO; - - -/* - * PortInfo - */ - -#define PORT_RESP_TIME_VALUE_MAX 8 - - -/* Link width, indicated as follows: - * values are additive for Supported and Enabled fields - */ -typedef enum _IB_LINK_WIDTH { - IB_LINK_WIDTH_NOP = 0, /* no change, valid only for LinkWidthEnabled */ - IB_LINK_WIDTH_1X = 1, - IB_LINK_WIDTH_4X = 2, - IB_LINK_WIDTH_8X = 4, - IB_LINK_WIDTH_12X = 8, - IB_LINK_WIDTH_ALL_SUPPORTED = 255 /* valid only for LinkWidthEnabled */ -} IB_LINK_WIDTH; - - -/* Link speed, indicated as follows: - * values are additive for Supported and Enabled fields - * Link speed extended values (FDR/EDR) are also included; note however, that - * extended values appear in PORT_INFO in LinkSpeedExt - */ -typedef enum _IB_LINK_SPEED { - IB_LINK_SPEED_NOP = 0, /* no change, valid only for enabled */ - IB_LINK_SPEED_DEFAULT = 1, /* 2.5Gbps (SDR) */ /* depricated */ - IB_LINK_SPEED_2_5G = 1, /* 2.5Gbps (SDR) */ /* use this one */ - IB_LINK_SPEED_5G = 2, /* 5.0Gbps (DDR) */ - IB_LINK_SPEED_10G = 4, /* 10.0Gbps (QDR) */ - IB_LINK_SPEED_RESERVED = 8, /* Reserved */ - IB_LINK_SPEED_14G = 16, /* 14.0625 Gbps (FDR) */ - IB_LINK_SPEED_25G = 32, /* 25.78125 Gbps (EDR) */ - IB_LINK_SPEED_ALL_SUPPORTED = 63 /* valid only for LinkSpeedEnabled */ -} IB_LINK_SPEED; - -/* Port States */ -#define IB_PORT_NOP PortStateNop /* 0 - No state change */ -#define IB_PORT_DOWN PortStateDown /* 1 - Down */ - /* includes failed links */ -#define IB_PORT_INIT PortStateInit /* 2 - Initialize */ -#define IB_PORT_ARMED PortStateArmed /* 3 - Armed */ -#define IB_PORT_ACTIVE PortStateActive /* 4 - Active */ -#define IB_PORT_STATE_MAX PortStateMax /* Maximum Valid Value */ - /* reserved 5-15 */ - -typedef enum _IB_PORT_PHYS_STATE { - IB_PORT_PHYS_NOP = 0, /* 0 - No State change */ - IB_PORT_PHYS_SLEEP = 1, /* 1 - sleep */ - IB_PORT_PHYS_POLLING = 2, /* 2 - polling */ - IB_PORT_PHYS_DISABLED = 3, /* 3 - disabled */ - IB_PORT_PHYS_TRAINING = 4, /* 4 - port config training */ - IB_PORT_PHYS_LINKUP = 5, /* 5 - linkup */ - IB_PORT_PHYS_LINK_ERROR_RECOVERY = 6, /* 6 - Link error recovery */ - IB_PORT_PHYS_MAX = 6, /* Maximum Valid Value */ - IB_PORT_PHYS_RESERVED = 7 /* 7 - 15 - reserved, ignored */ -} IB_PORT_PHYS_STATE; - -/* IB_MTU is defined in ib_types.h */ - -#define IB_LIFETIME_MAX 19 /* max for HOQLife and LifeTimeValue, >19 -> Infinite */ - -/* Values for M_KeyProtectBits */ -typedef enum _IB_MKEY_PROTECT { - IB_MKEY_PROTECT_RO = 0, /* Get allows any MKey, Set protected */ - IB_MKEY_PROTECT_HIDE = 1, /* Get allows any MKey, Resp Hides, Set protected */ - IB_MKEY_PROTECT_SECURE = 2, /* Get/Set Protected */ - IB_MKEY_PROTECT_SECURE2 = 3 /* Get/Set Protected */ -} IB_MKEY_PROTECT; - -/* Capability Mask A bit set to 1 for affirmation of supported capability - * by a given port - */ -typedef union _CapabilityMask { - uint32 AsReg32; - struct { IB_BITFIELD31( uint32, - CmReserved6: 1, /* shall be zero */ - IsMulticastFDBTopSupported: 1, - IsMulticastPKeyTrapSuppressionSupported:1, - CmReserved5: 2, /* shall be zero */ - IsOtherLocalChangeNoticeSupported: 1, - IsClientReregistrationSupported: 1, - IsLinkRoundTripLatencySupported: 1, - IsBootManagementSupported: 1, - IsCapabilityMaskNoticeSupported: 1, - IsDRNoticeSupported: 1, - IsVendorClassSupported: 1, - IsDeviceManagementSupported: 1, - IsReinitSupported: 1, - IsSNMPTunnelingSupported: 1, - IsConnectionManagementSupported: 1, - IsCapabilityMask2Supported: 1, - IsExtendedSpeedsSupported: 1, - IsCableInfoSupported: 1, - IsPKeySwitchExternalPortTrapSupported:1, - IsSystemImageGuidSupported: 1, - IsSMDisabled: 1, - IsLEDInfoSupported: 1, - IsPKeyNVRAM: 1, /* P_Key in NVRAM */ - IsMKeyNVRAM: 1, /* M_Key in NVRAM */ - IsSLMappingSupported: 1, - IsAutomaticMigrationSupported: 1, - CmReserved2: 1, - IsTrapSupported: 1, - IsNoticeSupported: 1, - IsSM: 1, - CmReserved1: 1 ) - } s; -} IB_CAPABILITY_MASK; - -typedef struct _PORT_INFO { - - uint64 M_Key; /* The 8-byte management key. */ - uint64 SubnetPrefix; /* Subnet prefix for this port. */ - /* Set to default value of XXXXX if no */ - /* other subnet interaction. */ - /* GidPrefix ??? */ - uint16 LID; /* The base LID of this port. */ - uint16 MasterSMLID; /* The base LID of the master SM that is */ - /* managing this port. */ - IB_CAPABILITY_MASK CapabilityMask; /* port capabilities */ - uint16 DiagCode; /* Diagnostic code, Refer Node Diagnostics */ - uint16 M_KeyLeasePeriod; - - uint8 LocalPortNum; /* The link port number this SMP came on in. */ - - struct _LinkWidth { - uint8 Enabled; /* Enabled link width */ - uint8 Supported; /* Supported link width */ - uint8 Active; /* Currently active link width */ - } LinkWidth; - - - struct { -#if CPU_BE - uint8 SpeedSupported: 4; /* Supported link speed */ - uint8 PortState: 4; /* Port State. */ -#else - uint8 PortState: 4; /* Port State. */ - uint8 SpeedSupported: 4; /* Supported link speed */ -#endif -#if CPU_BE - uint8 PortPhysicalState: 4; - uint8 DownDefaultState: 4; -#else - uint8 DownDefaultState: 4; - uint8 PortPhysicalState: 4; -#endif - } Link; - - struct { -#if CPU_BE - uint8 M_KeyProtectBits: 2; /* see mgmt key usage */ - uint8 Reserved: 3; /* reserved, shall be zero */ - uint8 LMC: 3; /* LID mask for multipath support */ -#else - uint8 LMC: 3; /* LID mask for multipath support */ - uint8 Reserved: 3; /* reserved, shall be zero */ - uint8 M_KeyProtectBits: 2; /* see mgmt key usage */ -#endif - } s1; - - struct _LinkSpeed { -#if CPU_BE - uint8 Active: 4; /* Currently active link speed */ - uint8 Enabled: 4; /* Enabled link speed */ -#else - uint8 Enabled: 4; /* Enabled link speed */ - uint8 Active: 4; /* Currently active link speed */ -#endif - } LinkSpeed; - - struct { -#if CPU_BE - uint8 NeighborMTU: 4; - uint8 MasterSMSL: 4; -#else - uint8 MasterSMSL: 4; /* The adminstrative SL of the master */ - /* SM that is managing this port. */ - uint8 NeighborMTU: 4; /* MTU of neighbor endnode connected */ - /* to this port */ -#endif - } s2; - - - struct { - struct { -#if CPU_BE - uint8 Cap: 4; /* Virtual Lanes supported on this port */ - uint8 InitType: 4; /* IB_PORT_INIT_TYPE */ -#else - uint8 InitType: 4; /* IB_PORT_INIT_TYPE */ - uint8 Cap: 4; /* Virtual Lanes supported on this port */ -#endif - } s; - - uint8 HighLimit; /* Limit of high priority component of */ - /* VL Arbitration table */ - uint8 ArbitrationHighCap; - uint8 ArbitrationLowCap; - } VL; - - struct { -#if CPU_BE - uint8 InitTypeReply: 4; /* IB_PORT_INIT_TYPE */ - uint8 Cap: 4; /* Maximum MTU supported by this port. */ -#else - uint8 Cap: 4; /* Maximum MTU supported by this port. */ - uint8 InitTypeReply: 4; /* IB_PORT_INIT_TYPE */ -#endif - } MTU; - - struct { /* transmitter Queueing Controls */ -#if CPU_BE - uint8 VLStallCount: 3; - uint8 HOQLife: 5; -#else - uint8 HOQLife: 5; /* Applies to routers & switches only */ - uint8 VLStallCount: 3; /* Applies to switches only. */ -#endif - } XmitQ; - - struct { -#if CPU_BE - uint8 OperationalVL: 4; /* Virtual Lanes */ - uint8 PartitionEnforcementInbound: 1; - uint8 PartitionEnforcementOutbound: 1; - uint8 FilterRawInbound: 1; - uint8 FilterRawOutbound: 1; -#else - uint8 FilterRawOutbound: 1; - uint8 FilterRawInbound: 1; - uint8 PartitionEnforcementOutbound: 1; - uint8 PartitionEnforcementInbound: 1; - uint8 OperationalVL: 4; /* Virtual Lanes */ - /* operational on this port */ -#endif - } s3; - - struct _Violations { - uint16 M_Key; - uint16 P_Key; - uint16 Q_Key; - } Violations; - - uint8 GUIDCap; /* Number of GID entries supported in the */ - /* GIDInfo attribute */ - - - struct { -#if CPU_BE - uint8 ClientReregister: 1; - uint8 Reserved: 2; - uint8 Timeout: 5; -#else - uint8 Timeout: 5; /* Timer value used for subnet timeout */ - uint8 Reserved: 2; - uint8 ClientReregister: 1; -#endif - } Subnet; - - - struct { -#if CPU_BE - uint8 Reserved: 3; - uint8 TimeValue: 5; -#else - uint8 TimeValue: 5; - uint8 Reserved: 3; -#endif - - } Resp; - - struct _ERRORS { -#if CPU_BE - uint8 LocalPhys: 4; - uint8 Overrun: 4; -#else - uint8 Overrun: 4; - uint8 LocalPhys: 4; -#endif - } Errors; - - uint16 MaxCreditHint; /* Max Credit Hint */ - - struct _LATENCY { -#if CPU_BE - uint32 Reserved: 8; - uint32 LinkRoundTrip: 24; /* LinkRoundTripLatency */ -#else - uint32 LinkRoundTrip: 24; - uint32 Reserved: 8; -#endif - } Latency; - - uint16 CapabilityMask2; /* Capability Mask 2 */ - - struct _LinkSpeedExt { -#if CPU_BE - uint8 Active: 4; /* Currently active link speed extended */ - uint8 Supported: 4; /* Supported link speed extended */ -#else - uint8 Supported: 4; /* Supported link speed extended */ - uint8 Active: 4; /* Currently active link speed extended */ -#endif -#if CPU_BE - uint8 Reserved: 3; /* Reserved */ - uint8 Enabled: 5; /* Enabled link speed extended */ -#else - uint8 Enabled: 5; /* Enabled link speed extended */ - uint8 Reserved: 3; /* Reserved */ -#endif - } LinkSpeedExt; - -} PACK_SUFFIX PORT_INFO; - - -#define SMP_PORT_STATE(x) (x)->Link.PortState -#define SMP_PORT_LMC(x) (x)->s1.LMC -#define SMP_PORT_LID(x) (x)->LID -#define SMP_PORT_SMLID(x) (x)->MasterSMLID -#define SMP_PORT_SM(x) (x)->CapabilityMask.s.IsSM -#define SMP_PORT_M_KEY_BITS(x) (x)->s1.M_KeyProtectBits - - - -/* - * PartitionTable - */ - -#define PARTITION_TABLE_BLOCK_SIZE 32 -#define PARTITION_TABLE_MAX_BLOCK_NUM 2047 - -typedef union _P_KeyBlock { - uint16 AsInt16; - - struct { - uint16 P_KeyBase: 15; /* Base value of the P_Key that */ - /* the endnode will use to check */ - /* against incoming packets */ - uint16 MembershipType: 1; /* 0 = Limited type */ - /* 1 = Full type */ - } p; - -} PACK_SUFFIX P_KEY_BLOCK; - -typedef struct _PARTITION_TABLE { - - P_KEY_BLOCK PartitionTableBlock[PARTITION_TABLE_BLOCK_SIZE]; /* List of P_Key Block elements */ - -} PACK_SUFFIX PARTITION_TABLE; - - - -/* - * ForwardingTable - */ - -typedef uint8 PORT; /* Port Block element */ - -typedef struct _LID_Port_Block { - uint16 LID; /* base LID */ - struct { -#if CPU_BE - uint8 Valid: 1; /* valid bit */ - uint8 LMC: 3; /* the LMC of this LID */ - uint8 reserved: 4; /* for alignment */ -#else - uint8 reserved: 4; /* for alignment */ - uint8 LMC: 3; /* the LMC of this LID */ - uint8 Valid: 1; /* valid bit */ -#endif - } s; - PORT Port; -} PACK_SUFFIX LID_PORT_BLOCK; - -typedef uint16 PORTMASK; /* port mask block element */ - -#define LFT_BLOCK_SIZE 64 -#define RFT_BLOCK_SIZE 16 -#define RFT_MAX_BLOCK_NUM 3071 -#define MFT_BLOCK_SIZE 32 -#define MFT_BLOCK_WIDTH 16 // width of portmask in bits -typedef struct _FORWARDING_TABLE { - - union { - - struct _Linear { - PORT LftBlock[64]; - } Linear; - - struct _Random { - LID_PORT_BLOCK RftBlock[16]; - } Random; - - struct _Multicast { - PORTMASK MftBlock[32]; - } Multicast; - } u; - -} PACK_SUFFIX FORWARDING_TABLE; - - - -/* - * SMInfo - */ - -typedef enum _SM_STATE { - SM_INACTIVE = 0, - SM_DISCOVERING, - SM_STANDBY, - SM_MASTER, - /* 4-255 - Reserved */ -} SM_STATE ; - -typedef struct _SM_INFO { - uint64 GUID; /* This SM's perception of the GUID */ - /* of the master SM. */ - uint64 SM_Key; /* Key of this SM. This is shown as 0 unless */ - /* the requesting SM is proven to be the */ - /* master, or the requester is otherwise */ - /* authenticated */ - uint32 ActCount; /* Counter that increments each time the SM */ - /* issues a SMP or performs other management */ - /* activities. Used as a 'heartbeat' indicator */ - /* by standby SMs. */ - struct { -#if CPU_BE - uint8 Priority: 4; - uint8 SMState: 4; -#else - uint8 SMState: 4; /* Enumerated value indicating this SM's state. */ - /* Enumerated as SM_STATE. */ - uint8 Priority: 4; /* Administratively assigned priority for this */ - /* SM. Can be reset by master SM. */ -#endif - } s; - -} PACK_SUFFIX SM_INFO; - -// SM Service Record -#define SM_SERVICE_ID (0x1100d03c34822222ull) -#define SM_CAPABILITY_NONE 0x00000000 -#define SM_CAPABILITY_VSWINFO 0x00000001 - -/* - * VendorDiag - */ - -typedef enum { - DIAG_NODE_READY = 0, - DIAG_SELF_TEST, - DIAG_INIT, - DIAG_SOFT_ERROR, - DIAG_HARD_ERROR, - DIAG_RESERVED -} IB_DIAG_CODE; - -typedef struct _VendorDiag { - - union { - uint16 NextIndex; /* Next attribute Modifier to get to Diag Info. */ - /* Set to zero if this s last or only */ - /* diag data. */ - struct { -#if CPU_BE - uint16 UniversalDiagCode: 4; - uint16 VendorDiagCode: 11; - uint16 Chain: 1; -#else /* CPU_LE */ - uint16 Chain: 1; - uint16 VendorDiagCode: 11; - uint16 UniversalDiagCode: 4; -#endif - } s; - } u; - - uint8 DiagData[62]; /* Vendor specific diag info. Format undefined. */ - -} PACK_SUFFIX VendorDiag, VENDOR_DIAG; - - - -/* LedInfo */ -typedef union _LedInfo { - uint32 AsReg32; - struct { -#if CPU_BE - uint32 LedMask: 1; /* MSB of this mask is set to 1 for LED on, */ - /* and 0 for LED off. */ - uint32 Reserved: 31; -#else /* CPU_LE */ - uint32 Reserved: 31; - uint32 LedMask: 1; /* MSB of this mask is set to 1 for LED on, */ - /* and 0 for LED off. */ -#endif - /* Response packet shall indicate actual */ - /* LED state. */ - /* All other bits are set to zero or */ - /* ignored on recv. */ - } s; - -} PACK_SUFFIX LedInfo, LED_INFO; - - -/* IcsLedInfo - * On ICS switches, the SMA sets the LED whenever any port is Active until - * a SubnSet(LedInfo) is received. - */ -typedef union _IcsLedInfo { - uint32 AsReg32; - struct { -#if CPU_BE - uint32 LedMask: 1; /* MSB of this mask is set to 1 for LED on, */ - /* and 0 for LED off. */ - uint32 LedAuto: 1; /* MSB of this mask is set to 1 for LED auto, */ - /* and 0 for LED default. */ - uint32 Reserved: 30; -#else /* CPU_LE */ - uint32 Reserved: 30; - uint32 LedAuto: 1; /* MSB of this mask is set to 1 for LED auto, */ - /* and 0 for LED default. */ - uint32 LedMask: 1; /* MSB of this mask is set to 1 for LED on, */ - /* and 0 for LED off. */ -#endif - /* Response packet shall indicate actual */ - /* LED state. */ - /* All other bits are set to zero or */ - /* ignored on recv. */ - } s; - -} PACK_SUFFIX IcsLedInfo, ICS_LED_INFO; - - -/* - * Define VL Arbitration table. - */ -#define IB_VLARBTABLE_SIZE 32 - -typedef struct _VLArbBlock{ - struct { -#if CPU_BE - uint8 Reserved: 4; - uint8 VL: 4; -#else - uint8 VL: 4; - uint8 Reserved: 4; -#endif /*CPU_BE */ - } s; - - uint8 Weight; -} PACK_SUFFIX VLArbBlock; - -typedef struct _VLARBTABLE { - VLArbBlock ArbTable[IB_VLARBTABLE_SIZE]; -} PACK_SUFFIX VLARBTABLE; - -/* Parts of VL Arb Table (specified in upper 16 bits of Attribute Modifier) */ -typedef enum _IB_VLARBTABLE_PART { - IB_VLARBTABLE_PART_FIRST = 1, - IB_VLARBTABLE_PART_LOW_LOW = 1, /* lower 32 entries of low priority */ - IB_VLARBTABLE_PART_UPPER_LOW = 2, /* upper 32 entries of low priority */ - IB_VLARBTABLE_PART_LOW_HIGH = 3, /* lower 32 entries of high priority */ - IB_VLARBTABLE_PART_UPPER_HIGH = 4, /* upper 32 entries of high priority */ - IB_VLARBTABLE_PART_LAST = 4 -} IB_VLARBTABLE_PART; - - -#define PGTABLE_LIST_COUNT 64 - -typedef struct _PORT_GROUP_TABLE { - uint8 PortGroup[PGTABLE_LIST_COUNT]; /* List of PortGroups indexed by port */ -} PACK_SUFFIX PORT_GROUP_TABLE; - -#define LIDMASK_LEN 64 - -typedef struct _ADAPTIVE_ROUTING_LIDMASK { - uint8 lidmask[LIDMASK_LEN]; // lidmask block of 512 lids -} PACK_SUFFIX ADAPTIVE_ROUTING_LIDMASK; - -/* - * SM attributes for TrueScale Collectives feature. See DN0310. - */ - -typedef enum { - CollReleasing = 1, - CollStop = 2, - CollResume = 3, - CollFailed = 4, - CollPublish = 5, -} VendorCollectiveNoticeStatus_t; - -typedef struct _COLLECTIVE_NOTICE { - uint8 collectiveStatus; // collective notice status - uint64 collectiveHash; // collective hash ID - uint64 nodeParent; // parent of the node -} PACK_SUFFIX COLLECTIVE_NOTICE; - -#define VENDOR_CMLIST_NODE_COUNT 8 // Nodes per block - -typedef struct _COLLECTIVE_MEMBER_LIST { - uint64 member[VENDOR_CMLIST_NODE_COUNT]; // list of members identified by GUID -} PACK_SUFFIX COLLECTIVE_MEMBER_LIST; - -#define VENDOR_CFT_MASK_COUNT 32 // max of 32*8 entries (256 port max) - -typedef struct _COLLECTIVE_FORWARDING_TABLE { - uint8 parentPort; // Port ID to parent, zero indicates none - uint8 children[VENDOR_CFT_MASK_COUNT]; // A bitmap of ports to children -} PACK_SUFFIX COLLECTIVE_FORWARDING_TABLE; - - -#include "iba/public/ipackoff.h" - -/* Is the Smp given from a local requestor (eg. on the same host such as a - * smp from IbAccess to its own local port or from a local SM) - * allow HopPointer to be 0 for direct use of GetSetMad and - * 1 for packets which passed through SMI prior to GetSetMad - */ -static __inline -boolean -SMP_IS_LOCAL( - IN SMP *Smp - ) -{ - return (( MCLASS_SM_DIRECTED_ROUTE == Smp->common.MgmtClass ) && - ( Smp->common.u.DR.HopPointer == 0 - || Smp->common.u.DR.HopPointer == 1) && - ( Smp->common.u.DR.HopCount == 0 )); -} - -static __inline -void -SMP_SET_LOCAL( - IN SMP *Smp - ) -{ - Smp->common.MgmtClass = MCLASS_SM_DIRECTED_ROUTE; - Smp->common.u.DR.HopPointer = 0; - Smp->common.u.DR.HopCount = 0; - Smp->SmpExt.DirectedRoute.DrSLID = LID_PERMISSIVE; - Smp->SmpExt.DirectedRoute.DrDLID = LID_PERMISSIVE; -} - -static __inline -void -BSWAP_SMP_HEADER( - SMP *Dest - ) -{ -#if CPU_LE - BSWAP_MAD_HEADER((MAD *)Dest); - - Dest->M_Key = ntoh64(Dest->M_Key); - Dest->SmpExt.DirectedRoute.DrSLID = \ - ntoh16(Dest->SmpExt.DirectedRoute.DrSLID); - Dest->SmpExt.DirectedRoute.DrDLID = \ - ntoh16(Dest->SmpExt.DirectedRoute.DrDLID); -#endif -} - -static __inline -void -BSWAP_SMA_TRAP_DATA_LINK_STATE( - SMA_TRAP_DATA_LINK_STATE *Dest - ) -{ -#if CPU_LE - Dest->ReportingLID = ntoh16(Dest->ReportingLID); -#endif -} - -static __inline -void -BSWAP_SMA_TRAP_DATA_LINK_INTEGRITY( - SMA_TRAP_DATA_LINK_INTEGRITY *Dest - ) -{ -#if CPU_LE - Dest->ReportingLID = ntoh16(Dest->ReportingLID); -#endif -} - -static __inline -void -BSWAP_SMA_TRAP_DATA_BUFFER_OVERRUN( - SMA_TRAP_DATA_BUFFER_OVERRUN *Dest - ) -{ -#if CPU_LE - Dest->ReportingLID = ntoh16(Dest->ReportingLID); -#endif -} - -static __inline -void -BSWAP_SMA_TRAP_DATA_FLOW_WATCHDOG( - SMA_TRAP_DATA_FLOW_WATCHDOG *Dest - ) -{ -#if CPU_LE - Dest->ReportingLID = ntoh16(Dest->ReportingLID); -#endif -} - -static __inline -void -BSWAP_SMA_TRAP_DATA_BAD_MKEY( - SMA_TRAP_DATA_BAD_MKEY *Dest - ) -{ -#if CPU_LE - Dest->RequestorLID = ntoh16(Dest->RequestorLID); - Dest->AttributeID = ntoh16(Dest->AttributeID); - Dest->AttributeModifier = ntoh32(Dest->AttributeModifier); - Dest->M_Key = ntoh64(Dest->M_Key); -#endif -} - -static __inline -void -BSWAP_SMA_TRAP_DATA_BAD_PKEY( - SMA_TRAP_DATA_BAD_PKEY *Dest - ) -{ -#if CPU_LE - Dest->SenderLID = ntoh16(Dest->SenderLID); - Dest->ReceiverLID = ntoh16(Dest->ReceiverLID); - Dest->P_Key = ntoh16(Dest->P_Key); - Dest->u1.AsReg32 = ntoh32(Dest->u1.AsReg32); - Dest->u2.AsReg32 = ntoh32(Dest->u2.AsReg32); - BSWAP_IB_GID(&Dest->SenderGID); - BSWAP_IB_GID(&Dest->ReceiverGID); -#endif -} - -static __inline -void -BSWAPCOPY_SMA_TRAP_DATA_BAD_PKEY( - SMA_TRAP_DATA_BAD_PKEY *Src, - SMA_TRAP_DATA_BAD_PKEY *Dest - ) -{ - memcpy(Dest, Src, sizeof(SMA_TRAP_DATA_BAD_PKEY)); - (void)BSWAP_SMA_TRAP_DATA_BAD_PKEY(Dest); -} - -static __inline -void -BSWAP_SMA_TRAP_DATA_BAD_QKEY( - SMA_TRAP_DATA_BAD_QKEY *Dest - ) -{ -#if CPU_LE - Dest->SenderLID = ntoh16(Dest->SenderLID); - Dest->ReceiverLID = ntoh16(Dest->ReceiverLID); - Dest->Q_Key = ntoh32(Dest->Q_Key); - Dest->u1.AsReg32 = ntoh32(Dest->u1.AsReg32); - Dest->u2.AsReg32 = ntoh32(Dest->u2.AsReg32); - BSWAP_IB_GID(&Dest->SenderGID); - BSWAP_IB_GID(&Dest->ReceiverGID); -#endif -} - -static __inline -void -BSWAP_NODE_DESCRIPTION( - NODE_DESCRIPTION *Dest - ) -{ - /* pure text field, nothing to swap */ -} - - -static __inline -void -BSWAP_NODE_INFO( - NODE_INFO *Dest - ) -{ -#if CPU_LE - Dest->SystemImageGUID = ntoh64(Dest->SystemImageGUID ); - Dest->NodeGUID = ntoh64(Dest->NodeGUID); - Dest->PortGUID = ntoh64(Dest->PortGUID); - Dest->PartitionCap = ntoh16(Dest->PartitionCap); - Dest->DeviceID = ntoh16(Dest->DeviceID); - Dest->Revision = ntoh32(Dest->Revision); - Dest->u1.AsReg32 = ntoh32(Dest->u1.AsReg32); -#endif -} - - -/* The extended flag should only be used when the PORT_INFO structure - * used contains the full set of fields. This is generally true for SMA - * operations, but when operating against SA PortInfoRecords the - * extra data may not be present - */ -static __inline -void -BSWAP_PORT_INFO( - PORT_INFO *Dest, int extended - ) -{ -#if CPU_LE - Dest->M_Key = ntoh64(Dest->M_Key); - Dest->SubnetPrefix = ntoh64(Dest->SubnetPrefix); - Dest->LID = ntoh16(Dest->LID); - Dest->MasterSMLID = ntoh16(Dest->MasterSMLID); - Dest->CapabilityMask.AsReg32 = ntoh32(Dest->CapabilityMask.AsReg32); - Dest->DiagCode = ntoh16(Dest->DiagCode); - Dest->M_KeyLeasePeriod = ntoh16(Dest->M_KeyLeasePeriod); - Dest->Violations.M_Key = ntoh16(Dest->Violations.M_Key); - Dest->Violations.P_Key = ntoh16(Dest->Violations.P_Key); - Dest->Violations.Q_Key = ntoh16(Dest->Violations.Q_Key); - Dest->MaxCreditHint = ntoh16(Dest->MaxCreditHint); - Dest->Latency.LinkRoundTrip = - ((Dest->Latency.LinkRoundTrip & 0x0000FF) << 16) | - (Dest->Latency.LinkRoundTrip & 0x00FF00) | - ((Dest->Latency.LinkRoundTrip & 0xFF0000) >> 16); - if (extended) - Dest->CapabilityMask2 = ntoh16(Dest->CapabilityMask2); -#endif -} - - -static __inline -void -BSWAP_PART_TABLE( - PARTITION_TABLE *Dest - ) -{ -#if CPU_LE - uint32 i; - - - for (i=0; i<32; i++) - { - Dest->PartitionTableBlock[i].AsInt16 = \ - ntoh16(Dest->PartitionTableBlock[i].AsInt16); - } -#endif -} - - -static __inline -void -BSWAP_SWITCH_INFO( - SWITCH_INFO *Dest - ) -{ -#if CPU_LE - Dest->LinearFDBCap = ntoh16(Dest->LinearFDBCap); - Dest->RandomFDBCap = ntoh16(Dest->RandomFDBCap); - Dest->MulticastFDBCap = ntoh16(Dest->MulticastFDBCap); - Dest->LinearFDBTop = ntoh16(Dest->LinearFDBTop); - Dest->LIDsPerPort = ntoh16(Dest->LIDsPerPort); - Dest->PartitionEnforcementCap = ntoh16(Dest->PartitionEnforcementCap); - Dest->MulticastFDBTop = ntoh16(Dest->MulticastFDBTop); -#endif -} - -static __inline -void -BSWAP_GUID_INFO( - GUID_INFO *Dest - ) -{ -#if CPU_LE - int i; - - for (i=0; iGid[i] = ntoh64(Dest->Gid[i]); - } -#endif -} - -static __inline -void -BSWAP_VLARBTABLE( - VLARBTABLE *Dest - ) -{ - /* we laid this out in network byte order for intel compilers */ -} - -static __inline -void -BSWAP_LINEAR_FWD_TABLE( - FORWARDING_TABLE *Dest - ) -{ -#if CPU_LE - /* nothing to do, PORT is only 1 byte */ -#endif -} - -static __inline -void -BSWAP_RANDOM_FWD_TABLE( - FORWARDING_TABLE *Dest - ) -{ -#if CPU_LE -#if defined(VXWORKS) - uint32 i; -#else - uint i; -#endif - - for (i=0; i< 16; ++i) - { - Dest->u.Random.RftBlock[i].LID = ntoh16(Dest->u.Random.RftBlock[i].LID); - } -#endif -} - -static __inline -void -BSWAP_MCAST_FWD_TABLE( - FORWARDING_TABLE *Dest - ) -{ -#if CPU_LE -#if defined(VXWORKS) - uint32 i; -#else - uint i; -#endif - - for (i=0; i< 32; ++i) - { - Dest->u.Multicast.MftBlock[i] = ntoh16(Dest->u.Multicast.MftBlock[i]); - } -#endif -} - -static __inline -void -BSWAP_SM_INFO( - SM_INFO *Dest - ) -{ -#if CPU_LE - Dest->GUID = ntoh64(Dest->GUID); - Dest->SM_Key = ntoh64(Dest->SM_Key); - Dest->ActCount = ntoh32(Dest->ActCount); -#endif -} - -static __inline -void -BSWAP_VENDOR_DIAG( - VENDOR_DIAG *Dest - ) -{ -#if CPU_LE - Dest->u.NextIndex = ntoh32(Dest->u.NextIndex); -#endif -} - -static __inline -void -BSWAP_LED_INFO( - LED_INFO *Dest - ) -{ -#if CPU_LE - Dest->AsReg32 = ntoh32(Dest->AsReg32); -#endif -} - -static __inline -void -BSWAP_ICS_LED_INFO( - ICS_LED_INFO *Dest - ) -{ -#if CPU_LE - Dest->AsReg32 = ntoh32(Dest->AsReg32); -#endif -} - -static __inline -void -BSWAP_PORT_GROUP_TABLE( - PORT_GROUP_TABLE *Dest - ) -{ -} - -static __inline -void -BSWAP_ADAPTIVE_ROUTING_LIDMASK( - ADAPTIVE_ROUTING_LIDMASK *Dest - ) -{ -} - -static __inline -void -BSWAP_COLLECTIVE_NOTICE( - COLLECTIVE_NOTICE *Dest - ) -{ -#if CPU_LE - Dest->collectiveHash = ntoh64(Dest->collectiveHash); - Dest->nodeParent = ntoh64(Dest->nodeParent); -#endif -} - -static __inline -void -BSWAP_COLLECTIVE_MEMBER_LIST( - COLLECTIVE_MEMBER_LIST *Dest - ) -{ -#if CPU_LE -#if defined(VXWORKS) - uint32 i; -#else - uint i; -#endif - - for (i=0; i< VENDOR_CMLIST_NODE_COUNT; ++i) - { - Dest->member[i] = ntoh64(Dest->member[i]); - } -#endif -} - -static __inline -void -BSWAP_COLLECTIVE_FORWARDING_TABLE( - COLLECTIVE_FORWARDING_TABLE *Dest - ) -{ -} - - -#if defined (__cplusplus) -}; -#endif - -#endif /* __IBA_IB_SM_H__ */ diff --git a/IbAccess/Common/Inc/ib_sm_priv.h b/IbAccess/Common/Inc/ib_sm_priv.h new file mode 100644 index 00000000..a1bf445b --- /dev/null +++ b/IbAccess/Common/Inc/ib_sm_priv.h @@ -0,0 +1,686 @@ +/* BEGIN_ICS_COPYRIGHT3 **************************************** + +Copyright (c) 2017, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +** END_ICS_COPYRIGHT3 ****************************************/ + +/* [ICS VERSION STRING: unknown] */ + +#ifndef __IBA_IB_SM_PRIV_H__ +#define __IBA_IB_SM_PRIV_H__ + +#include "iba/ib_sm_types.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +#include "iba/public/ipackon.h" + +/* ************************************************************************* + * SMPs + */ + +/* SMP Fields (LID Routed/Directed Route) */ +typedef struct _SMP { + + MAD_COMMON common; + uint64 M_Key; /* A 64 bit key, */ + /* employed for SM authentication */ + union { + struct _LIDRouted + { + uint8 Reserved3[32]; /* For aligning the SMP data field with */ + /* the directed route SMP data field */ + uint8 SMPData[64]; /* 64 byte field of SMP data used to */ + /* contain the methods attribute */ + uint8 Reserved4[128]; /* Reserved. Shall be set to 0 */ + } LIDRouted; + + struct _DirectedRoute + { + uint16 DrSLID; /* Directed route source LID */ + uint16 DrDLID; /* Directed route destination LID */ + uint8 Reserved2[28]; /* For the purpose of aligning the Data */ + /* field on a 64 byte boundary */ + + uint8 SMPData[64]; /* 64-byte field of SMP data used to */ + /* contain the methods attribute */ + uint8 InitPath[64]; /* 64-byte field containing the initial */ + /* directed path */ + uint8 RetPath[64]; /* 64-byte field containing the */ + /* returning directed path */ + } DirectedRoute; + }SmpExt; + +} PACK_SUFFIX SMP; + +#if 0 +#define SMP_SET_VERSION_INFO(smp, basever, mgmtcl, clver) {\ + MAD_SET_VERSION_INFO(smp, basever, mgmtcl, clver); \ +} + +#define SMP_GET_VERSION_INFO(smp, basever, mgmtcl, clver) {\ + MAD_GET_VERSION_INFO(smp, basever, mgmtcl, clver); \ +} +#endif + +#define SMP_GET_STATUS(smp, status) {\ + MAD_GET_STATUS(smp, status); \ +} + +#define SMP_GET_DR_STATUS(smp, status, d) { \ + (*status) = (smp)->common.u.DR.s.Status; \ + if( NULL != d){\ + (*d) = (smp)->common.u.DR.s.D; \ + }\ +} + +#define SMP_SET_HOP_POINTER(smp, hop_ptr) { \ + (smp)->common.u.DR.HopPointer = hop_ptr; \ +} + +#define SMP_GET_HOP_POINTER(smp, hop_ptr) { \ + (*hop_ptr) = (smp)->common.u.DR.HopPointer; \ +} + +#define SMP_SET_HOP_COUNT(smp, hop_count) { \ + (smp)->common.u.DR.HopCount = hop_count; \ +} + +#define SMP_GET_HOP_COUNT(smp, hop_count) { \ + (*hop_count) = (x)->common.u.DR.HopCount; \ +} + +#define SMP_SET_TRANSACTION_ID(smp, id) {\ + MAD_SET_TRANSACTION_ID(smp, id); \ +} + +#define SMP_GET_TRANSACTION_ID(smp, id) {\ + MAD_GET_TRANSACTION_ID(smp, id); \ +} + +#define SMP_SET_ATTRIB_ID(smp, id) {\ + MAD_SET_ATTRIB_ID(smp, id); \ +} + +#define SMP_GET_ATTRIB_ID(smp, id) {\ + MAD_GET_ATTRIB_ID(smp, id); \ +} + +#define SMP_SET_ATTRIB_MOD(smp, amod) {\ + MAD_SET_ATTRIB_MOD(smp, amod); \ +} + +#define SMP_GET_ATTRIB_MOD(smp, amod) {\ + MAD_GET_ATTRIB_MOD(smp, amod); \ +} + +#define SMP_SET_M_KEY(smp, mkey) {\ + (smp)->M_Key = mkey; \ +} + +#define SMP_GET_M_KEY(smp, mkey) {\ + (mkey) = (smp)->M_Key; \ +} + +#define SMP_LR_DATA SmpExt.LIDRouted.SMPData + +#define SMP_DR_DLID SmpExt.DirectedRoute.DrDLID +#define SMP_DR_SLID SmpExt.DirectedRoute.DrSLID +#define SMP_DR_DATA SmpExt.DirectedRoute.SMPData +#define SMP_DR_IPath SmpExt.DirectedRoute.InitPath +#define SMP_DR_RPath SmpExt.DirectedRoute.RetPath + + +/* ************************************************************************** + * Attribute specific SMP Packet Formats + */ + +/* + * SMA Notices/Traps (Data field for IB_NOTICE, see ib_mad.h) + */ + + /* Trap Numbers */ +#define SMA_TRAP_GID_NOW_IN_SERVICE 64 /* is now in service */ +#define SMA_TRAP_GID_OUT_OF_SERVICE 65 /* is out of service */ +#define SMA_TRAP_ADD_MULTICAST_GROUP 66 /* New multicast group with multicast address is now created */ +#define SMA_TRAP_DEL_MULTICAST_GROUP 67 /* New multicast group with multicast address is now deleted */ +#define SMA_TRAP_LINK_STATE 128 /* Switch port link state has changed */ +#define SMA_TRAP_LINK_INTEGRITY 129 /* Any link integrity threshold reached */ +#define SMA_TRAP_BUFFER_OVERRUN 130 /* Any buffer overrun threshold reached */ +#define SMA_TRAP_FLOW_WATCHDOG 131 /* Switch flow control update watchdog */ +#define SMA_TRAP_CHG_CAPABILITY 144 /* capability mask changed */ +#define SMA_TRAP_CHG_PLATGUID 145 /* platform (system) guid changed */ +#define SMA_TRAP_BAD_MKEY 256 /* Any bad M_key */ +#define SMA_TRAP_BAD_PKEY 257 /* Any bad P_key */ +#define SMA_TRAP_BAD_QKEY 258 /* Any bad Q_key */ +#define SMA_TRAP_SWITCH_BAD_PKEY 259 /* Switch bad P_key */ + +/* + * SwitchInfo + */ +typedef struct _SWITCH_INFO { + uint16 LinearFDBCap; /* Number of entries supported in the */ + /* Linear Unicast Forwarding Database */ + uint16 RandomFDBCap; /* Number of entries supported in the */ + /* Random Unicast Forwarding Database. */ + uint16 MulticastFDBCap; /* Number of entries supported in the */ + /* Multicast Forwarding Database */ + uint16 LinearFDBTop; /* Indicates the top of the linear */ + /* forwarding table. */ + uint8 DefaultPort; /* forward to this port all unicast */ + /* packets from other ports */ + /* whose DLID does not exist in the random */ + /* fwd table */ + uint8 DefaultMulticastPrimaryPort; + uint8 DefaultMulticastNotPrimaryPort; + union { + uint8 AsReg8; + struct { +#if CPU_BE + uint8 LifeTimeValue: 5; + uint8 PortStateChange: 1; + uint8 OptimizedSLVL: 2; +#else + uint8 OptimizedSLVL: 2; + uint8 PortStateChange:1; /* This bit is set to zero by a */ + /* management write. */ + uint8 LifeTimeValue: 5; /* Sets the time a packet can live in */ + /* the switch. See section XXX */ +#endif + } s; + } u1; + uint16 LIDsPerPort; /* specifies no. of LID/LMC combinations */ + /* that may be assigned */ + /* to a given link port for switches that */ + /* support the Random Forwarding database */ + /* model */ + uint16 PartitionEnforcementCap;/* Specifies the number of entries in the */ + /* partition enforcement table. */ + union { + uint8 AsReg8; + struct { +#if CPU_BE + uint8 InboundEnforcementCapable: 1; + uint8 OutboundEnforcementCapable: 1; + uint8 FilterRawPacketInboundCapable: 1; + uint8 FilterRawPacketOutboundCapable: 1; + uint8 EnhancedPort0: 1; + uint8 reserved: 3; +#else + uint8 reserved: 3; + uint8 EnhancedPort0: 1; + uint8 FilterRawPacketOutboundCapable: 1; + uint8 FilterRawPacketInboundCapable: 1; + uint8 OutboundEnforcementCapable: 1; + uint8 InboundEnforcementCapable: 1; +#endif /*CPU_BE */ + } s; + } u2; + + uint8 Reserved2; + + uint16 MulticastFDBTop; /* Indicates the top of the multicast */ + /* forwarding table. */ +} PACK_SUFFIX SWITCH_INFO; + + +/* + * GuidInfo + */ + +/* The GuidInfo Attribute allows the setting of GUIDs to an end port. */ +#define GUID_INFO_BLOCK_SIZE 8 +#define GUID_INFO_MAX_BLOCK_NUM 31 + +typedef struct _GUID_INFO { + /* Gid 0 in block 0 is Read only invariant value of the BASE GUID */ + uint64 Gid[GUID_INFO_BLOCK_SIZE]; +} PACK_SUFFIX GUID_INFO; + +/* + * PartitionTable + */ + +#define PARTITION_TABLE_BLOCK_SIZE 32 +#define PARTITION_TABLE_MAX_BLOCK_NUM 2047 + +typedef union _P_KeyBlock { + uint16 AsInt16; + + struct { + uint16 P_KeyBase: 15; /* Base value of the P_Key that */ + /* the endnode will use to check */ + /* against incoming packets */ + uint16 MembershipType: 1; /* 0 = Limited type */ + /* 1 = Full type */ + } p; + +} PACK_SUFFIX P_KEY_BLOCK; + +typedef struct _PARTITION_TABLE { + + P_KEY_BLOCK PartitionTableBlock[PARTITION_TABLE_BLOCK_SIZE]; /* List of P_Key Block elements */ + +} PACK_SUFFIX PARTITION_TABLE; + + + +/* + * ForwardingTable + */ + +typedef struct _LID_Port_Block { + uint16 LID; /* base LID */ + struct { +#if CPU_BE + uint8 Valid: 1; /* valid bit */ + uint8 LMC: 3; /* the LMC of this LID */ + uint8 reserved: 4; /* for alignment */ +#else + uint8 reserved: 4; /* for alignment */ + uint8 LMC: 3; /* the LMC of this LID */ + uint8 Valid: 1; /* valid bit */ +#endif + } s; + PORT Port; +} PACK_SUFFIX LID_PORT_BLOCK; + +typedef uint16 PORTMASK; /* port mask block element */ + +#define LFT_BLOCK_SIZE 64 +#define RFT_BLOCK_SIZE 16 +#define RFT_MAX_BLOCK_NUM 3071 +#define MFT_BLOCK_SIZE 32 +#define MFT_BLOCK_WIDTH 16 // width of portmask in bits +typedef struct _FORWARDING_TABLE { + + union { + + struct _Linear { + PORT LftBlock[64]; + } Linear; + + struct _Random { + LID_PORT_BLOCK RftBlock[16]; + } Random; + + struct _Multicast { + PORTMASK MftBlock[32]; + } Multicast; + } u; + +} PACK_SUFFIX FORWARDING_TABLE; + + + +/* + * SMInfo + */ + +typedef enum _SM_STATE { + SM_INACTIVE = 0, + SM_DISCOVERING, + SM_STANDBY, + SM_MASTER, + /* 4-255 - Reserved */ +} SM_STATE ; + +typedef struct _SM_INFO { + uint64 GUID; /* This SM's perception of the GUID */ + /* of the master SM. */ + uint64 SM_Key; /* Key of this SM. This is shown as 0 unless */ + /* the requesting SM is proven to be the */ + /* master, or the requester is otherwise */ + /* authenticated */ + uint32 ActCount; /* Counter that increments each time the SM */ + /* issues a SMP or performs other management */ + /* activities. Used as a 'heartbeat' indicator */ + /* by standby SMs. */ + struct { +#if CPU_BE + uint8 Priority: 4; + uint8 SMState: 4; +#else + uint8 SMState: 4; /* Enumerated value indicating this SM's state. */ + /* Enumerated as SM_STATE. */ + uint8 Priority: 4; /* Administratively assigned priority for this */ + /* SM. Can be reset by master SM. */ +#endif + } s; + +} PACK_SUFFIX SM_INFO; + +// SM Service Record +#define SM_SERVICE_ID (0x1100d03c34822222ull) +#define SM_CAPABILITY_NONE 0x00000000 +#define SM_CAPABILITY_VSWINFO 0x00000001 + +/* convert SM State to text */ +static __inline const char* +IbSMStateToText(SM_STATE state) +{ + return (state == SM_INACTIVE? "Inactive": + state == SM_DISCOVERING? "Discovering": + state == SM_STANDBY? "Standby": + state == SM_MASTER? "Master": "???"); +} + +/* + * VendorDiag + */ + +typedef enum { + DIAG_NODE_READY = 0, + DIAG_SELF_TEST, + DIAG_INIT, + DIAG_SOFT_ERROR, + DIAG_HARD_ERROR, + DIAG_RESERVED +} IB_DIAG_CODE; + +typedef struct _VendorDiag { + + union { + uint16 NextIndex; /* Next attribute Modifier to get to Diag Info. */ + /* Set to zero if this s last or only */ + /* diag data. */ + struct { +#if CPU_BE + uint16 UniversalDiagCode: 4; + uint16 VendorDiagCode: 11; + uint16 Chain: 1; +#else /* CPU_LE */ + uint16 Chain: 1; + uint16 VendorDiagCode: 11; + uint16 UniversalDiagCode: 4; +#endif + } s; + } u; + + uint8 DiagData[62]; /* Vendor specific diag info. Format undefined. */ + +} PACK_SUFFIX VendorDiag, VENDOR_DIAG; + + +/* + * Define VL Arbitration table. + */ +#define IB_VLARBTABLE_SIZE 32 + +typedef struct _VLArbBlock{ + struct { +#if CPU_BE + uint8 Reserved: 4; + uint8 VL: 4; +#else + uint8 VL: 4; + uint8 Reserved: 4; +#endif /*CPU_BE */ + } s; + + uint8 Weight; +} PACK_SUFFIX VLArbBlock; + +typedef struct _VLARBTABLE { + VLArbBlock ArbTable[IB_VLARBTABLE_SIZE]; +} PACK_SUFFIX VLARBTABLE; + +#define PGTABLE_LIST_COUNT 64 + +typedef struct _PORT_GROUP_TABLE { + uint8 PortGroup[PGTABLE_LIST_COUNT]; /* List of PortGroups indexed by port */ +} PACK_SUFFIX PORT_GROUP_TABLE; + +#define LIDMASK_LEN 64 + +typedef struct _ADAPTIVE_ROUTING_LIDMASK { + uint8 lidmask[LIDMASK_LEN]; // lidmask block of 512 lids +} PACK_SUFFIX ADAPTIVE_ROUTING_LIDMASK; + +#include "iba/public/ipackoff.h" + +static __inline void +BSWAP_SMP_HEADER( + SMP *Dest + ) +{ +#if CPU_LE + BSWAP_MAD_HEADER((MAD *)Dest); + + Dest->M_Key = ntoh64(Dest->M_Key); + Dest->SmpExt.DirectedRoute.DrSLID = \ + ntoh16(Dest->SmpExt.DirectedRoute.DrSLID); + Dest->SmpExt.DirectedRoute.DrDLID = \ + ntoh16(Dest->SmpExt.DirectedRoute.DrDLID); +#endif +} + +static __inline void +BSWAP_NODE_DESCRIPTION( + NODE_DESCRIPTION *Dest + ) +{ + /* pure text field, nothing to swap */ +} + + +static __inline void +BSWAP_NODE_INFO( + NODE_INFO *Dest + ) +{ +#if CPU_LE + Dest->SystemImageGUID = ntoh64(Dest->SystemImageGUID ); + Dest->NodeGUID = ntoh64(Dest->NodeGUID); + Dest->PortGUID = ntoh64(Dest->PortGUID); + Dest->PartitionCap = ntoh16(Dest->PartitionCap); + Dest->DeviceID = ntoh16(Dest->DeviceID); + Dest->Revision = ntoh32(Dest->Revision); + Dest->u1.AsReg32 = ntoh32(Dest->u1.AsReg32); +#endif +} + + +/* The extended flag should only be used when the PORT_INFO structure + * used contains the full set of fields. This is generally true for SMA + * operations, but when operating against SA PortInfoRecords the + * extra data may not be present + */ +static __inline void +BSWAP_PORT_INFO( + PORT_INFO *Dest, int extended + ) +{ +#if CPU_LE + Dest->M_Key = ntoh64(Dest->M_Key); + Dest->SubnetPrefix = ntoh64(Dest->SubnetPrefix); + Dest->LID = ntoh16(Dest->LID); + Dest->MasterSMLID = ntoh16(Dest->MasterSMLID); + Dest->CapabilityMask.AsReg32 = ntoh32(Dest->CapabilityMask.AsReg32); + Dest->DiagCode = ntoh16(Dest->DiagCode); + Dest->M_KeyLeasePeriod = ntoh16(Dest->M_KeyLeasePeriod); + Dest->Violations.M_Key = ntoh16(Dest->Violations.M_Key); + Dest->Violations.P_Key = ntoh16(Dest->Violations.P_Key); + Dest->Violations.Q_Key = ntoh16(Dest->Violations.Q_Key); + Dest->MaxCreditHint = ntoh16(Dest->MaxCreditHint); + Dest->Latency.LinkRoundTrip = + ((Dest->Latency.LinkRoundTrip & 0x0000FF) << 16) | + (Dest->Latency.LinkRoundTrip & 0x00FF00) | + ((Dest->Latency.LinkRoundTrip & 0xFF0000) >> 16); + if (extended) + Dest->CapabilityMask2 = ntoh16(Dest->CapabilityMask2); +#endif +} + + +static __inline void +BSWAP_PART_TABLE( + PARTITION_TABLE *Dest + ) +{ +#if CPU_LE + uint32 i; + + + for (i=0; i<32; i++) + { + Dest->PartitionTableBlock[i].AsInt16 = \ + ntoh16(Dest->PartitionTableBlock[i].AsInt16); + } +#endif +} + + +static __inline void +BSWAP_SWITCH_INFO( + SWITCH_INFO *Dest + ) +{ +#if CPU_LE + Dest->LinearFDBCap = ntoh16(Dest->LinearFDBCap); + Dest->RandomFDBCap = ntoh16(Dest->RandomFDBCap); + Dest->MulticastFDBCap = ntoh16(Dest->MulticastFDBCap); + Dest->LinearFDBTop = ntoh16(Dest->LinearFDBTop); + Dest->LIDsPerPort = ntoh16(Dest->LIDsPerPort); + Dest->PartitionEnforcementCap = ntoh16(Dest->PartitionEnforcementCap); + Dest->MulticastFDBTop = ntoh16(Dest->MulticastFDBTop); +#endif +} + +static __inline void +BSWAP_GUID_INFO( + GUID_INFO *Dest + ) +{ +#if CPU_LE + int i; + + for (i=0; iGid[i] = ntoh64(Dest->Gid[i]); + } +#endif +} + +static __inline void +BSWAP_VLARBTABLE( + VLARBTABLE *Dest + ) +{ + /* we laid this out in network byte order for intel compilers */ +} + +static __inline void +BSWAP_LINEAR_FWD_TABLE( + FORWARDING_TABLE *Dest + ) +{ +#if CPU_LE + /* nothing to do, PORT is only 1 byte */ +#endif +} + +static __inline void +BSWAP_RANDOM_FWD_TABLE( + FORWARDING_TABLE *Dest + ) +{ +#if CPU_LE +#if defined(VXWORKS) + uint32 i; +#else + uint i; +#endif + + for (i=0; i< 16; ++i) + { + Dest->u.Random.RftBlock[i].LID = ntoh16(Dest->u.Random.RftBlock[i].LID); + } +#endif +} + +static __inline void +BSWAP_MCAST_FWD_TABLE( + FORWARDING_TABLE *Dest + ) +{ +#if CPU_LE +#if defined(VXWORKS) + uint32 i; +#else + uint i; +#endif + + for (i=0; i< 32; ++i) + { + Dest->u.Multicast.MftBlock[i] = ntoh16(Dest->u.Multicast.MftBlock[i]); + } +#endif +} + +static __inline void +BSWAP_SM_INFO( + SM_INFO *Dest + ) +{ +#if CPU_LE + Dest->GUID = ntoh64(Dest->GUID); + Dest->SM_Key = ntoh64(Dest->SM_Key); + Dest->ActCount = ntoh32(Dest->ActCount); +#endif +} + +static __inline void +BSWAP_VENDOR_DIAG( + VENDOR_DIAG *Dest + ) +{ +#if CPU_LE + Dest->u.NextIndex = ntoh32(Dest->u.NextIndex); +#endif +} + +static __inline void +BSWAP_PORT_GROUP_TABLE( + PORT_GROUP_TABLE *Dest + ) +{ +} + +static __inline void +BSWAP_ADAPTIVE_ROUTING_LIDMASK( + ADAPTIVE_ROUTING_LIDMASK *Dest + ) +{ +} + +#if defined (__cplusplus) +}; +#endif + +#endif /* __IBA_IB_SM_PRIV_H__ */ diff --git a/IbAccess/Common/Inc/ib_sm_types.h b/IbAccess/Common/Inc/ib_sm_types.h new file mode 100644 index 00000000..34629ef4 --- /dev/null +++ b/IbAccess/Common/Inc/ib_sm_types.h @@ -0,0 +1,476 @@ +/* BEGIN_ICS_COPYRIGHT3 **************************************** + +Copyright (c) 2017, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +** END_ICS_COPYRIGHT3 ****************************************/ + +/* [ICS VERSION STRING: unknown] */ + +#ifndef __IBA_IB_SM_TYPES_H__ +#define __IBA_IB_SM_TYPES_H__ + +#include "iba/public/datatypes.h" +#include "iba/stl_mad_types.h" +#include "iba/public/ibyteswap.h" + +// CPU_LE code below can't get to uint typedef +#if defined(VXWORKS) +typedef unsigned int uint; +#endif + +#if defined (__cplusplus) +extern "C" { +#endif + +#include "iba/public/ipackon.h" + +/* + * Defines + */ + +#define IB_SM_CLASS_VERSION 1 /* Subnet Management */ + +/* SMP Attributes */ +#define MCLASS_ATTRIB_ID_NODE_DESCRIPTION 0x0010 /* Node description string */ +#define MCLASS_ATTRIB_ID_NODE_INFO 0x0011 /* Generic node data */ +#define MCLASS_ATTRIB_ID_SWITCH_INFO 0x0012 /* Switch information */ +/* 0x0013 reserved (was RouterInfo) */ +#define MCLASS_ATTRIB_ID_GUID_INFO 0x0014 /* Assigned GIDs */ +#define MCLASS_ATTRIB_ID_PORT_INFO 0x0015 /* Port Information */ +#define MCLASS_ATTRIB_ID_PART_TABLE 0x0016 /* Partition Table */ + +#define MCLASS_ATTRIB_ID_SL_VL_MAPPING_TABLE 0x0017 /* Service level to */ + /* Virtual Lane mapping info */ +#define MCLASS_ATTRIB_ID_VL_ARBITRATION 0x0018 /* List of weights */ +#define MCLASS_ATTRIB_ID_LINEAR_FWD_TABLE 0x0019 /* Linear forwarding table */ +#define MCLASS_ATTRIB_ID_RANDOM_FWD_TABLE 0x001A /* Random forwarding */ + /* database information */ +#define MCLASS_ATTRIB_ID_MCAST_FWD_TABLE 0x001B /* Multicast forwarding */ + /* database information */ + +#define MCLASS_ATTRIB_ID_SM_INFO 0x0020 /* Subnet Manager */ + /* Information */ +/* 0x0021 reserved - was RoutingInfo */ +#define MCLASS_ATTRIB_ID_VENDOR_DIAG 0x0030 /* Vendor specific */ + /* Diagnostic */ +#define MCLASS_ATTRIB_ID_LED_INFO 0x0031 /* Turn on/off LED */ + +#define MCLASS_ATTRIB_ID_PORT_LFT 0xff19 /* Port Linear forwarding table */ +#define MCLASS_ATTRIB_ID_PORT_GROUP 0xff21 /* Vendor Port Group Info */ +#define MCLASS_ATTRIB_ID_AR_LIDMASK 0xff22 /* LID Mask for Adaptive Routing */ + +#define MCLASS_ATTRIB_ID_COLLECTIVE_NOTICE 0xff40 /* Vendor unique collective notice */ +#define MCLASS_ATTRIB_ID_CMLIST 0xff41 /* Vendor unique collective multicast list */ +#define MCLASS_ATTRIB_ID_CFT 0xff42 /* Vendor unique collective forwarding table */ + +/* SMP Attribute Modifiers */ +#define MCLASS_ATTRIB_MOD_SUPPORTS_EXT_SPEEDS 0x80000000 /* SMSupportsExtendedLinkSpeeds */ + +typedef uint8 PORT; /* Convenience type. */ + +/* + * NodeInfo + */ +typedef struct _NODE_INFO { + + uint8 BaseVersion; /* Supported MAD Base Version. */ + uint8 ClassVersion; /* Supported Subnet Management Class */ + /* (SMP) Version. */ + uint8 NodeType; + uint8 NumPorts; /* Number of link ports on this node. */ + + /* note GUIDs on 4 byte boundary */ + uint64 SystemImageGUID; + + uint64 NodeGUID; /* GUID of the HCA, TCA, switch, */ + /* or router itself. */ + uint64 PortGUID; /* GUID of this end port itself. */ + + uint16 PartitionCap; /* Number of entries in the Partition Table */ + /* for end ports. */ + uint16 DeviceID; /* Device ID information as assigned by */ + /* device manufacturer. */ + uint32 Revision; /* Device revision, assigned by manufacturer. */ + + union { + uint32 AsReg32; + + struct { +#if CPU_BE + uint32 LocalPortNum: 8; /* The link port number this */ + uint32 VendorID: 24; /* Device vendor, per IEEE. */ +#else + uint32 VendorID: 24; /* Device vendor, per IEEE. */ + uint32 LocalPortNum: 8; /* The link port number this */ + /* SMP came on in. */ +#endif + } s; + } u1; + +} PACK_SUFFIX NODE_INFO; + + +/* + * NodeDescription + */ + +#define NODE_DESCRIPTION_ARRAY_SIZE 64 + +typedef struct _NODE_DESCRIPTION { + + /* Node String is an array of UTF-8 character that */ + /* describes the node in text format */ + /* Note that this string is NOT NULL TERMINATED! */ + uint8 NodeString[NODE_DESCRIPTION_ARRAY_SIZE]; + +} PACK_SUFFIX NODE_DESCRIPTION; + + + +/* + * PortInfo + */ + +#define PORT_RESP_TIME_VALUE_MAX 8 + + +/* Link width, indicated as follows: + * values are additive for Supported and Enabled fields + */ +typedef enum _IB_LINK_WIDTH { + IB_LINK_WIDTH_NOP = 0, /* no change, valid only for LinkWidthEnabled */ + IB_LINK_WIDTH_1X = 1, + IB_LINK_WIDTH_4X = 2, + IB_LINK_WIDTH_8X = 4, + IB_LINK_WIDTH_12X = 8, + IB_LINK_WIDTH_ALL_SUPPORTED = 255 /* valid only for LinkWidthEnabled */ +} IB_LINK_WIDTH; + + +/* Link speed, indicated as follows: + * values are additive for Supported and Enabled fields + * Link speed extended values (FDR/EDR) are also included; note however, that + * extended values appear in PORT_INFO in LinkSpeedExt + */ +typedef enum _IB_LINK_SPEED { + IB_LINK_SPEED_NOP = 0, /* no change, valid only for enabled */ + IB_LINK_SPEED_DEFAULT = 1, /* 2.5Gbps (SDR) */ /* depricated */ + IB_LINK_SPEED_2_5G = 1, /* 2.5Gbps (SDR) */ /* use this one */ + IB_LINK_SPEED_5G = 2, /* 5.0Gbps (DDR) */ + IB_LINK_SPEED_10G = 4, /* 10.0Gbps (QDR) */ + IB_LINK_SPEED_RESERVED = 8, /* Reserved */ + IB_LINK_SPEED_14G = 16, /* 14.0625 Gbps (FDR) */ + IB_LINK_SPEED_25G = 32, /* 25.78125 Gbps (EDR) */ + IB_LINK_SPEED_ALL_SUPPORTED = 63 /* valid only for LinkSpeedEnabled */ +} IB_LINK_SPEED; + +/* Port States */ +#define IB_PORT_NOP PortStateNop /* 0 - No state change */ +#define IB_PORT_DOWN PortStateDown /* 1 - Down */ + /* includes failed links */ +#define IB_PORT_INIT PortStateInit /* 2 - Initialize */ +#define IB_PORT_ARMED PortStateArmed /* 3 - Armed */ +#define IB_PORT_ACTIVE PortStateActive /* 4 - Active */ +#define IB_PORT_STATE_MAX PortStateMax /* Maximum Valid Value */ + /* reserved 5-15 */ + +typedef enum _IB_PORT_PHYS_STATE { + IB_PORT_PHYS_NOP = 0, /* 0 - No State change */ + IB_PORT_PHYS_SLEEP = 1, /* 1 - sleep */ + IB_PORT_PHYS_POLLING = 2, /* 2 - polling */ + IB_PORT_PHYS_DISABLED = 3, /* 3 - disabled */ + IB_PORT_PHYS_TRAINING = 4, /* 4 - port config training */ + IB_PORT_PHYS_LINKUP = 5, /* 5 - linkup */ + IB_PORT_PHYS_LINK_ERROR_RECOVERY = 6, /* 6 - Link error recovery */ + IB_PORT_PHYS_MAX = 6, /* Maximum Valid Value */ + IB_PORT_PHYS_RESERVED = 7 /* 7 - 15 - reserved, ignored */ +} IB_PORT_PHYS_STATE; + +/* IB_MTU is defined in ib_types.h */ + +#define IB_LIFETIME_MAX 19 /* max for HOQLife and LifeTimeValue, >19 -> Infinite */ + +/* Values for M_KeyProtectBits */ +typedef enum _IB_MKEY_PROTECT { + IB_MKEY_PROTECT_RO = 0, /* Get allows any MKey, Set protected */ + IB_MKEY_PROTECT_HIDE = 1, /* Get allows any MKey, Resp Hides, Set protected */ + IB_MKEY_PROTECT_SECURE = 2, /* Get/Set Protected */ + IB_MKEY_PROTECT_SECURE2 = 3 /* Get/Set Protected */ +} IB_MKEY_PROTECT; + +/* Capability Mask A bit set to 1 for affirmation of supported capability + * by a given port + */ +typedef union _CapabilityMask { + uint32 AsReg32; + struct { IB_BITFIELD31( uint32, + CmReserved6: 1, /* shall be zero */ + IsMulticastFDBTopSupported: 1, + IsMulticastPKeyTrapSuppressionSupported:1, + CmReserved5: 2, /* shall be zero */ + IsOtherLocalChangeNoticeSupported: 1, + IsClientReregistrationSupported: 1, + IsLinkRoundTripLatencySupported: 1, + IsBootManagementSupported: 1, + IsCapabilityMaskNoticeSupported: 1, + IsDRNoticeSupported: 1, + IsVendorClassSupported: 1, + IsDeviceManagementSupported: 1, + IsReinitSupported: 1, + IsSNMPTunnelingSupported: 1, + IsConnectionManagementSupported: 1, + IsCapabilityMask2Supported: 1, + IsExtendedSpeedsSupported: 1, + IsCableInfoSupported: 1, + IsPKeySwitchExternalPortTrapSupported:1, + IsSystemImageGuidSupported: 1, + IsSMDisabled: 1, + IsLEDInfoSupported: 1, + IsPKeyNVRAM: 1, /* P_Key in NVRAM */ + IsMKeyNVRAM: 1, /* M_Key in NVRAM */ + IsSLMappingSupported: 1, + IsAutomaticMigrationSupported: 1, + CmReserved2: 1, + IsTrapSupported: 1, + IsNoticeSupported: 1, + IsSM: 1, + CmReserved1: 1 ) + } s; +} IB_CAPABILITY_MASK; + +typedef struct _PORT_INFO { + + uint64 M_Key; /* The 8-byte management key. */ + uint64 SubnetPrefix; /* Subnet prefix for this port. */ + /* Set to default value of XXXXX if no */ + /* other subnet interaction. */ + /* GidPrefix ??? */ + uint16 LID; /* The base LID of this port. */ + uint16 MasterSMLID; /* The base LID of the master SM that is */ + /* managing this port. */ + IB_CAPABILITY_MASK CapabilityMask; /* port capabilities */ + uint16 DiagCode; /* Diagnostic code, Refer Node Diagnostics */ + uint16 M_KeyLeasePeriod; + + uint8 LocalPortNum; /* The link port number this SMP came on in. */ + + struct _LinkWidth { + uint8 Enabled; /* Enabled link width */ + uint8 Supported; /* Supported link width */ + uint8 Active; /* Currently active link width */ + } LinkWidth; + + + struct { +#if CPU_BE + uint8 SpeedSupported: 4; /* Supported link speed */ + uint8 PortState: 4; /* Port State. */ +#else + uint8 PortState: 4; /* Port State. */ + uint8 SpeedSupported: 4; /* Supported link speed */ +#endif +#if CPU_BE + uint8 PortPhysicalState: 4; + uint8 DownDefaultState: 4; +#else + uint8 DownDefaultState: 4; + uint8 PortPhysicalState: 4; +#endif + } Link; + + struct { +#if CPU_BE + uint8 M_KeyProtectBits: 2; /* see mgmt key usage */ + uint8 Reserved: 3; /* reserved, shall be zero */ + uint8 LMC: 3; /* LID mask for multipath support */ +#else + uint8 LMC: 3; /* LID mask for multipath support */ + uint8 Reserved: 3; /* reserved, shall be zero */ + uint8 M_KeyProtectBits: 2; /* see mgmt key usage */ +#endif + } s1; + + struct _LinkSpeed { +#if CPU_BE + uint8 Active: 4; /* Currently active link speed */ + uint8 Enabled: 4; /* Enabled link speed */ +#else + uint8 Enabled: 4; /* Enabled link speed */ + uint8 Active: 4; /* Currently active link speed */ +#endif + } LinkSpeed; + + struct { +#if CPU_BE + uint8 NeighborMTU: 4; + uint8 MasterSMSL: 4; +#else + uint8 MasterSMSL: 4; /* The adminstrative SL of the master */ + /* SM that is managing this port. */ + uint8 NeighborMTU: 4; /* MTU of neighbor endnode connected */ + /* to this port */ +#endif + } s2; + + + struct { + struct { +#if CPU_BE + uint8 Cap: 4; /* Virtual Lanes supported on this port */ + uint8 InitType: 4; /* IB_PORT_INIT_TYPE */ +#else + uint8 InitType: 4; /* IB_PORT_INIT_TYPE */ + uint8 Cap: 4; /* Virtual Lanes supported on this port */ +#endif + } s; + + uint8 HighLimit; /* Limit of high priority component of */ + /* VL Arbitration table */ + uint8 ArbitrationHighCap; + uint8 ArbitrationLowCap; + } VL; + + struct { +#if CPU_BE + uint8 InitTypeReply: 4; /* IB_PORT_INIT_TYPE */ + uint8 Cap: 4; /* Maximum MTU supported by this port. */ +#else + uint8 Cap: 4; /* Maximum MTU supported by this port. */ + uint8 InitTypeReply: 4; /* IB_PORT_INIT_TYPE */ +#endif + } MTU; + + struct { /* transmitter Queueing Controls */ +#if CPU_BE + uint8 VLStallCount: 3; + uint8 HOQLife: 5; +#else + uint8 HOQLife: 5; /* Applies to routers & switches only */ + uint8 VLStallCount: 3; /* Applies to switches only. */ +#endif + } XmitQ; + + struct { +#if CPU_BE + uint8 OperationalVL: 4; /* Virtual Lanes */ + uint8 PartitionEnforcementInbound: 1; + uint8 PartitionEnforcementOutbound: 1; + uint8 FilterRawInbound: 1; + uint8 FilterRawOutbound: 1; +#else + uint8 FilterRawOutbound: 1; + uint8 FilterRawInbound: 1; + uint8 PartitionEnforcementOutbound: 1; + uint8 PartitionEnforcementInbound: 1; + uint8 OperationalVL: 4; /* Virtual Lanes */ + /* operational on this port */ +#endif + } s3; + + struct _Violations { + uint16 M_Key; + uint16 P_Key; + uint16 Q_Key; + } Violations; + + uint8 GUIDCap; /* Number of GID entries supported in the */ + /* GIDInfo attribute */ + + + struct { +#if CPU_BE + uint8 ClientReregister: 1; + uint8 Reserved: 2; + uint8 Timeout: 5; +#else + uint8 Timeout: 5; /* Timer value used for subnet timeout */ + uint8 Reserved: 2; + uint8 ClientReregister: 1; +#endif + } Subnet; + + + struct { +#if CPU_BE + uint8 Reserved: 3; + uint8 TimeValue: 5; +#else + uint8 TimeValue: 5; + uint8 Reserved: 3; +#endif + + } Resp; + + struct _ERRORS { +#if CPU_BE + uint8 LocalPhys: 4; + uint8 Overrun: 4; +#else + uint8 Overrun: 4; + uint8 LocalPhys: 4; +#endif + } Errors; + + uint16 MaxCreditHint; /* Max Credit Hint */ + + struct _LATENCY { +#if CPU_BE + uint32 Reserved: 8; + uint32 LinkRoundTrip: 24; /* LinkRoundTripLatency */ +#else + uint32 LinkRoundTrip: 24; + uint32 Reserved: 8; +#endif + } Latency; + + uint16 CapabilityMask2; /* Capability Mask 2 */ + + struct _LinkSpeedExt { +#if CPU_BE + uint8 Active: 4; /* Currently active link speed extended */ + uint8 Supported: 4; /* Supported link speed extended */ +#else + uint8 Supported: 4; /* Supported link speed extended */ + uint8 Active: 4; /* Currently active link speed extended */ +#endif +#if CPU_BE + uint8 Reserved: 3; /* Reserved */ + uint8 Enabled: 5; /* Enabled link speed extended */ +#else + uint8 Enabled: 5; /* Enabled link speed extended */ + uint8 Reserved: 3; /* Reserved */ +#endif + } LinkSpeedExt; + +} PACK_SUFFIX PORT_INFO; + +#include "iba/public/ipackoff.h" + +#if defined (__cplusplus) +}; +#endif + +#endif /* __IBA_IB_SM_TYPES_H__ */ diff --git a/IbAccess/Common/Inc/ib_smi.h b/IbAccess/Common/Inc/ib_smi.h index 2dd1b22c..aa3e9e5e 100644 --- a/IbAccess/Common/Inc/ib_smi.h +++ b/IbAccess/Common/Inc/ib_smi.h @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "iba/stl_types.h" -#include "iba/stl_sm.h" +#include "iba/stl_sm_types.h" #if defined (__cplusplus) diff --git a/IbAccess/Common/Inc/ib_types.h b/IbAccess/Common/Inc/ib_types.h index 8f7d4ea7..0ed2f02f 100644 --- a/IbAccess/Common/Inc/ib_types.h +++ b/IbAccess/Common/Inc/ib_types.h @@ -29,14 +29,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* [ICS VERSION STRING: unknown] */ -#if defined(CHECK_HEADERS) - -#ifndef _IBA_STL_TYPES_H_ -#warning FIX ME!!! Your includes should use the stl_types.h header and not the ib_types.h header for STL builds -#endif - -#endif - #ifndef _IBA_IB_TYPES_H_ #define _IBA_IB_TYPES_H_ diff --git a/IbAccess/Common/Inc/ibt.h b/IbAccess/Common/Inc/ibt.h index 5dd6124c..e75f3feb 100644 --- a/IbAccess/Common/Inc/ibt.h +++ b/IbAccess/Common/Inc/ibt.h @@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "iba/ib_cm.h" #endif #include "iba/stl_sd.h" -#include "iba/stl_pa.h" +#include "iba/stl_pa_priv.h" #include "iba/ib_avtracker.h" #include "iba/umadt.h" #ifdef BUILD_DMC diff --git a/IbAccess/Common/Inc/stl_helper.h b/IbAccess/Common/Inc/stl_helper.h index 9b5b2f68..ae188866 100644 --- a/IbAccess/Common/Inc/stl_helper.h +++ b/IbAccess/Common/Inc/stl_helper.h @@ -34,8 +34,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "ib_helper.h" -#include "iba/stl_sm.h" -#include "iba/stl_pa.h" +#include "iba/stl_sm_types.h" +#include "iba/stl_pa_types.h" #if defined(VXWORKS) #include "private/stdioP.h" // pick up snprintf extern definition #endif @@ -48,30 +48,27 @@ extern "C" { /* * STL defines an algorithmic relationship between NodeGUID and PortGUID - * Bit 32-34 of the NodeGUID always has 1 - * Bit 32-34 of the PortGUID has 1 for switch port 0, or the HFI port number - * These bits should never be 0 + * Bit 30-31 of the NodeGUID always has 0 + * Bit 30-31 of the PortGUID has 0 for switch port 0, or the HFI port number - 1 * These functions help translate from one to the other */ -#define PORTGUID_PNUM_MASK 0x7ull // bit field mask -#define PORTGUID_PNUM_SHIFT 32 // low bit number +#define PORTGUID_PNUM_SHIFT 30 // low bit number +#define PORTGUID_PNUM_MASK (0x3ull << PORTGUID_PNUM_SHIFT) // bit field mask static __inline EUI64 PortGUIDtoNodeGUID(EUI64 portGUID) { - return ((portGUID & ~(PORTGUID_PNUM_MASK << PORTGUID_PNUM_SHIFT)) - | (1ull << PORTGUID_PNUM_SHIFT)); + return portGUID & ~PORTGUID_PNUM_MASK; } static __inline EUI64 NodeGUIDtoPortGUID(EUI64 nodeGUID, uint8 portnum) { - // assume portnum is valid, in which case it can't be zero for HFIs - // and can only be zero for switches + // assume portnum is valid, in which case it must be zero for switches + // or 1-4 (which we must convert to 0 relative) for HFIs // hence avoiding the need for a NodeType argument to this function - if (portnum) - return ((nodeGUID & ~(PORTGUID_PNUM_MASK << PORTGUID_PNUM_SHIFT)) - | ((EUI64)portnum << PORTGUID_PNUM_SHIFT)); // HFI port - else - return nodeGUID; // switch port 0 + if (portnum) portnum--; + + return (nodeGUID & ~PORTGUID_PNUM_MASK) + | (((EUI64)portnum << PORTGUID_PNUM_SHIFT) & PORTGUID_PNUM_MASK); } /* @@ -661,15 +658,6 @@ StlPortOfflineDisabledReasonToText(uint8 offlineReason) }; } -static __inline const char* -StlSMStateToText(SM_STATE state) -{ - return ((state == SM_INACTIVE)? "Inactive": - (state == SM_DISCOVERING)? "Discovering": - (state == SM_STANDBY)? "Standby": - (state == SM_MASTER)? "Master": "???"); -} - static __inline void FormatStlCapabilityMask3(char *buf, STL_CAPABILITY_MASK3 cmask, int buflen) { @@ -1559,46 +1547,6 @@ static __inline CounterSelectMask_t DiffPAVFCounters(STL_PA_VF_PORT_COUNTERS_DAT return mask; } -/** - * Copy data in a STL_PORT_COUNTERS_DATA variable into a STL_PortStatusData_t variable - * - * @param portCounters - pointer to STL_PORT_COUNTERS_DATA variable from which to copy - * @param portStatusData - pointer to STL_PortStatusData_t variable to copy to - * - */ -static __inline void StlPortCountersToPortStatus(STL_PORT_COUNTERS_DATA *portCounters, STL_PORT_STATUS_RSP *portStatusData) -{ - portStatusData->LinkErrorRecovery = portCounters->linkErrorRecovery; - portStatusData->LinkDowned = portCounters->linkDowned; - portStatusData->PortRcvErrors = portCounters->portRcvErrors; - portStatusData->PortRcvRemotePhysicalErrors = portCounters->portRcvRemotePhysicalErrors; - portStatusData->PortRcvSwitchRelayErrors = portCounters->portRcvSwitchRelayErrors; - portStatusData->PortXmitDiscards = portCounters->portXmitDiscards; - portStatusData->PortXmitConstraintErrors = portCounters->portXmitConstraintErrors; - portStatusData->PortRcvConstraintErrors = portCounters->portRcvConstraintErrors; - portStatusData->LocalLinkIntegrityErrors = portCounters->localLinkIntegrityErrors; - portStatusData->ExcessiveBufferOverruns = portCounters->excessiveBufferOverruns; - portStatusData->PortXmitData = portCounters->portXmitData; - portStatusData->PortRcvData = portCounters->portRcvData; - portStatusData->PortXmitPkts = portCounters->portXmitPkts; - portStatusData->PortRcvPkts = portCounters->portRcvPkts; - portStatusData->PortMulticastXmitPkts = portCounters->portMulticastXmitPkts; - portStatusData->PortMulticastRcvPkts = portCounters->portMulticastRcvPkts; - portStatusData->PortXmitWait = portCounters->portXmitWait; - portStatusData->SwPortCongestion = portCounters->swPortCongestion; - portStatusData->PortRcvFECN = portCounters->portRcvFECN; - portStatusData->PortRcvBECN = portCounters->portRcvBECN; - portStatusData->PortXmitTimeCong = portCounters->portXmitTimeCong; - portStatusData->PortXmitWastedBW = portCounters->portXmitWastedBW; - portStatusData->PortXmitWaitData = portCounters->portXmitWaitData; - portStatusData->PortRcvBubble = portCounters->portRcvBubble; - portStatusData->PortMarkFECN = portCounters->portMarkFECN; - portStatusData->FMConfigErrors = portCounters->fmConfigErrors; - portStatusData->UncorrectableErrors = portCounters->uncorrectableErrors; - portStatusData->lq.AsReg8 = portCounters->lq.AsReg8; - -} - #if !defined(ROUNDUP) #define ROUNDUP(val, align) ((((uintn)(val)+(uintn)(align)-1)/((uintn)align))*((uintn)(align))) #endif diff --git a/IbAccess/Common/Inc/stl_mad_priv.h b/IbAccess/Common/Inc/stl_mad_priv.h new file mode 100644 index 00000000..0f4d8c4a --- /dev/null +++ b/IbAccess/Common/Inc/stl_mad_priv.h @@ -0,0 +1,139 @@ +/* BEGIN_ICS_COPYRIGHT7 **************************************** + +Copyright (c) 2015, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +** END_ICS_COPYRIGHT7 ****************************************/ + +/* [ICS VERSION STRING: unknown] */ + +#ifndef __IBA_STL_MAD_PRIV_H__ +#define __IBA_STL_MAD_PRIV_H__ + +#define STL_MAD_BLOCK_SIZE 2048 +#include "iba/stl_mad_types.h" +#include "iba/stl_types.h" +#include "iba/ib_types.h" +#include "iba/ib_mad.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/* + * MAD Base Fields + */ +typedef MAD STL_MAD; + +/* + * Convenience functions for converting MAD packets from host to network byte + * byte order (or vice-versa). + */ + +static __inline +void +BSWAP_STL_CLASS_PORT_INFO( + STL_CLASS_PORT_INFO *Dest + ) +{ +#if CPU_LE + Dest->CapMask = ntoh16(Dest->CapMask); + Dest->u1.AsReg32 = ntoh32(Dest->u1.AsReg32); + BSWAP_IB_GID(&Dest->RedirectGID); + Dest->u2.AsReg32 = ntoh32(Dest->u2.AsReg32); + Dest->RedirectLID = ntoh32(Dest->RedirectLID); + Dest->u3.AsReg32 = ntoh32(Dest->u3.AsReg32); + Dest->Redirect_Q_Key = ntoh32(Dest->Redirect_Q_Key); + BSWAP_IB_GID(&Dest->TrapGID); + Dest->u4.AsReg32 = ntoh32(Dest->u4.AsReg32); + Dest->TrapLID = ntoh32(Dest->TrapLID); + Dest->u5.AsReg32 = ntoh32(Dest->u5.AsReg32); + Dest->Trap_Q_Key = ntoh32(Dest->Trap_Q_Key); + Dest->Trap_P_Key = ntoh16(Dest->Trap_P_Key); + Dest->Redirect_P_Key = ntoh16(Dest->Redirect_P_Key); +#endif +} + + + +static __inline +void BSWAP_STL_NOTICE(STL_NOTICE * notice) +{ +#if CPU_LE + if (notice->Attributes.Generic.u.s.IsGeneric) { + notice->Attributes.Generic.u.AsReg32 = ntoh32(notice->Attributes.Generic.u.AsReg32); + notice->Attributes.Generic.TrapNumber = ntoh16(notice->Attributes.Generic.TrapNumber); + } + else { + notice->Attributes.Vendor.u.AsReg32 = ntoh32(notice->Attributes.Vendor.u.AsReg32); + notice->Attributes.Vendor.DeviceID = ntoh16(notice->Attributes.Vendor.DeviceID); + } + + notice->Stats.AsReg16 = ntoh16(notice->Stats.AsReg16); + notice->IssuerLID = ntoh32(notice->IssuerLID); + + BSWAP_IB_GID(¬ice->IssuerGID); +#endif +} + +static __inline +void BSWAPCOPY_STL_NOTICE(STL_NOTICE * src, STL_NOTICE * dst) +{ + memcpy(dst, src, sizeof(STL_NOTICE)); + (void)BSWAP_STL_NOTICE(dst); +} + +static __inline +void +BSWAP_STL_INFORM_INFO(STL_INFORM_INFO *dst) +{ +#if CPU_LE + BSWAP_IB_GID(&dst->GID); + + dst->LIDRangeBegin = ntoh32(dst->LIDRangeBegin); + dst->LIDRangeEnd = ntoh32(dst->LIDRangeEnd); + dst->Type = ntoh16(dst->Type); + dst->u.Generic.TrapNumber = ntoh16(dst->u.Generic.TrapNumber); + dst->u.Generic.u1.AsReg32 = ntoh32(dst->u.Generic.u1.AsReg32); + dst->u.Generic.u2.AsReg32 = ntoh32(dst->u.Generic.u2.AsReg32); +#endif +} + +static __inline +void +BSWAPCOPY_STL_INFORM_INFO(STL_INFORM_INFO *src, STL_INFORM_INFO *dst) +{ +#if CPU_LE + memcpy(dst, src, sizeof(STL_INFORM_INFO)); + BSWAP_STL_INFORM_INFO(dst); +#endif +} + +#if defined (__cplusplus) +}; +#endif + +#endif /* __IBA_STL_MAD_PRIV_H__ */ + diff --git a/IbAccess/Common/Inc/stl_mad.h b/IbAccess/Common/Inc/stl_mad_types.h similarity index 74% rename from IbAccess/Common/Inc/stl_mad.h rename to IbAccess/Common/Inc/stl_mad_types.h index 553b30a2..18865220 100644 --- a/IbAccess/Common/Inc/stl_mad.h +++ b/IbAccess/Common/Inc/stl_mad_types.h @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT7 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -29,37 +29,24 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* [ICS VERSION STRING: unknown] */ -#ifndef __IBA_STL_MAD_H__ -#define __IBA_STL_MAD_H__ - -#define STL_MAD_BLOCK_SIZE 2048 +#ifndef __IBA_STL_MAD_TYPES_H__ +#define __IBA_STL_MAD_TYPES_H__ +#include "iba/public/datatypes.h" #include "iba/stl_types.h" -#include "iba/ib_types.h" #include "iba/ib_mad.h" #if defined (__cplusplus) extern "C" { #endif -#include "iba/public/ipackon.h" - -/* -------------------------------------------------------------------------- - * Defines - */ - -#define STL_BASE_VERSION 0x80 +#define STL_BASE_VERSION 0x80 /* * STL equivalents of IBA_NODE_CHANNEL_ADAPTER and IBA_NODE_SWITCH. */ -#define STL_NODE_FI 1 -#define STL_NODE_SW 2 - -/* - * MAD Base Fields - */ -typedef MAD STL_MAD; +#define STL_NODE_FI 1 +#define STL_NODE_SW 2 /* * The following MADs are generic across all management classes. @@ -75,27 +62,7 @@ typedef MAD STL_MAD; #define STL_CLASS_PORT_CAPMASK_NOTICE 0x0002 /* Implements Get/Set Notice */ #define STL_CLASS_PORT_CAPMASK_CM2 0x0004 /* Implements Additional Class Specific Capabilities (CapMask2) */ -static __inline void -StlCommonClassPortInfoCapMask(char buf[80], uint16 cmask) -{ - if (!cmask) { - snprintf(buf, 80, "-"); - } else { - snprintf(buf, 80, "%s%s%s", - (cmask & STL_CLASS_PORT_CAPMASK_TRAP) ? "Trap " : "", - (cmask & STL_CLASS_PORT_CAPMASK_NOTICE) ? "Notice " : "", - (cmask & STL_CLASS_PORT_CAPMASK_CM2) ? "CapMask2 " : ""); - } -} -static __inline void -StlCommonClassPortInfoCapMask2(char buf[80], uint32 cmask) -{ - if (!cmask) { - snprintf(buf, 80, "-"); - } else { - buf[0] = '\0'; - } -} +#include "iba/public/ipackon.h" /* * Class Port Info: @@ -114,6 +81,7 @@ StlCommonClassPortInfoCapMask2(char buf[80], uint32 cmask) * Trap_P_Key moved for qword alignment. * RedirectSL and TrapSL moved to handle longer lengths. */ + typedef struct { uint8 BaseVersion; // RO: Must be STL_BASE_VERSION uint8 ClassVersion; // RO @@ -157,7 +125,7 @@ typedef struct { STL_FIELDUNION3(u4, 32, TrapTClass:8, // RW Reserved3:4, // Must be zero. - TrapFlowLabel:20); // RW: TODO: Convert to reserved? + TrapFlowLabel:20); // RW uint32 TrapLID; // Lengthened for STL. @@ -185,109 +153,6 @@ typedef struct { } STL_CLASS_PORT_INFO; -static __inline -void -BSWAP_STL_CLASS_PORT_INFO( - STL_CLASS_PORT_INFO *Dest - ) -{ -#if CPU_LE - Dest->CapMask = ntoh16(Dest->CapMask); - Dest->u1.AsReg32 = ntoh32(Dest->u1.AsReg32); - BSWAP_IB_GID(&Dest->RedirectGID); - Dest->u2.AsReg32 = ntoh32(Dest->u2.AsReg32); - Dest->RedirectLID = ntoh32(Dest->RedirectLID); - Dest->u3.AsReg32 = ntoh32(Dest->u3.AsReg32); - Dest->Redirect_Q_Key = ntoh32(Dest->Redirect_Q_Key); - BSWAP_IB_GID(&Dest->TrapGID); - Dest->u4.AsReg32 = ntoh32(Dest->u4.AsReg32); - Dest->TrapLID = ntoh32(Dest->TrapLID); - Dest->u5.AsReg32 = ntoh32(Dest->u5.AsReg32); - Dest->Trap_Q_Key = ntoh32(Dest->Trap_Q_Key); - Dest->Trap_P_Key = ntoh16(Dest->Trap_P_Key); - Dest->Redirect_P_Key = ntoh16(Dest->Redirect_P_Key); -#endif -} - - - -/* - * Notice - * - * All STL fabrics should use the STL Notice structure when communicating with - * STL devices and applications. When forwarding notices to IB applications, - * the SM shall translate them into IB format, when IB equivalents exist. - * - * STL Differences: - * IssuerLID is now 32 bits. - * Moved fields to maintain word alignment. - * Data and ClassTrapSpecificData combined into a single field. - */ -typedef struct { - union { - /* Generic Notice attributes */ - struct /*_GENERIC*/ { - STL_FIELDUNION3(u, 32, - IsGeneric:1, // RO - Type:7, // RO - ProducerType:24); // RO - uint16 TrapNumber; // RO - } PACK_SUFFIX Generic; - - /* Vendor specific Notice attributes */ - struct /*_VENDOR*/ { - STL_FIELDUNION3(u, 32, - IsGeneric:1, // RO - Type:7, // RO - VendorID:24); // RO - uint16 DeviceID; // RO - } PACK_SUFFIX Vendor; - } PACK_SUFFIX Attributes; - - STL_FIELDUNION2(Stats, 16, - Toggle:1, // RW - Count:15); // RW - - /* 8 bytes */ - uint32 IssuerLID; // RO: Extended for STL - uint32 Reserved2; // Added for qword alignment - /* 16 bytes */ - IB_GID IssuerGID; // RO - /* 32 bytes */ - uint8 Data[64]; // RO. - /* 96 bytes */ - uint8 ClassData[0]; // RO. Variable length. -} PACK_SUFFIX STL_NOTICE; - - -static __inline -void BSWAP_STL_NOTICE(STL_NOTICE * notice) -{ -#if CPU_LE - if (notice->Attributes.Generic.u.s.IsGeneric) { - notice->Attributes.Generic.u.AsReg32 = ntoh32(notice->Attributes.Generic.u.AsReg32); - notice->Attributes.Generic.TrapNumber = ntoh16(notice->Attributes.Generic.TrapNumber); - } - else { - notice->Attributes.Vendor.u.AsReg32 = ntoh32(notice->Attributes.Vendor.u.AsReg32); - notice->Attributes.Vendor.DeviceID = ntoh16(notice->Attributes.Vendor.DeviceID); - } - - notice->Stats.AsReg16 = ntoh16(notice->Stats.AsReg16); - notice->IssuerLID = ntoh32(notice->IssuerLID); - - BSWAP_IB_GID(¬ice->IssuerGID); -#endif -} - -static __inline -void BSWAPCOPY_STL_NOTICE(STL_NOTICE * src, STL_NOTICE * dst) -{ - memcpy(dst, src, sizeof(STL_NOTICE)); - (void)BSWAP_STL_NOTICE(dst); -} - - /* * InformInfoRecord * @@ -348,37 +213,81 @@ typedef struct { /* 40 bytes */ } STL_INFORM_INFO; -static __inline -void -BSWAP_STL_INFORM_INFO(STL_INFORM_INFO *dst) + +/* + * Notice + * + * All STL fabrics should use the STL Notice structure when communicating with + * STL devices and applications. When forwarding notices to IB applications, + * the SM shall translate them into IB format, when IB equivalents exist. + * + * STL Differences: + * IssuerLID is now 32 bits. + * Moved fields to maintain word alignment. + * Data and ClassTrapSpecificData combined into a single field. + */ +typedef struct { + union { + /* Generic Notice attributes */ + struct /*_GENERIC*/ { + STL_FIELDUNION3(u, 32, + IsGeneric:1, // RO + Type:7, // RO + ProducerType:24); // RO + uint16 TrapNumber; // RO + } PACK_SUFFIX Generic; + + /* Vendor specific Notice attributes */ + struct /*_VENDOR*/ { + STL_FIELDUNION3(u, 32, + IsGeneric:1, // RO + Type:7, // RO + VendorID:24); // RO + uint16 DeviceID; // RO + } PACK_SUFFIX Vendor; + } PACK_SUFFIX Attributes; + + STL_FIELDUNION2(Stats, 16, + Toggle:1, // RW + Count:15); // RW + + /* 8 bytes */ + uint32 IssuerLID; // RO: Extended for STL + uint32 Reserved2; // Added for qword alignment + /* 16 bytes */ + IB_GID IssuerGID; // RO + /* 32 bytes */ + uint8 Data[64]; // RO. + /* 96 bytes */ + uint8 ClassData[0]; // RO. Variable length. +} PACK_SUFFIX STL_NOTICE; + +#include "iba/public/ipackoff.h" + +static __inline void +StlCommonClassPortInfoCapMask(char buf[80], uint16 cmask) { -#if CPU_LE - BSWAP_IB_GID(&dst->GID); - - dst->LIDRangeBegin = ntoh32(dst->LIDRangeBegin); - dst->LIDRangeEnd = ntoh32(dst->LIDRangeEnd); - dst->Type = ntoh16(dst->Type); - dst->u.Generic.TrapNumber = ntoh16(dst->u.Generic.TrapNumber); - dst->u.Generic.u1.AsReg32 = ntoh32(dst->u.Generic.u1.AsReg32); - dst->u.Generic.u2.AsReg32 = ntoh32(dst->u.Generic.u2.AsReg32); -#endif + if (!cmask) { + snprintf(buf, 80, "-"); + } else { + snprintf(buf, 80, "%s%s%s", + (cmask & STL_CLASS_PORT_CAPMASK_TRAP) ? "Trap " : "", + (cmask & STL_CLASS_PORT_CAPMASK_NOTICE) ? "Notice " : "", + (cmask & STL_CLASS_PORT_CAPMASK_CM2) ? "CapMask2 " : ""); + } } -static __inline -void -BSWAPCOPY_STL_INFORM_INFO(STL_INFORM_INFO *src, STL_INFORM_INFO *dst) +static __inline void +StlCommonClassPortInfoCapMask2(char buf[80], uint32 cmask) { -#if CPU_LE - memcpy(dst, src, sizeof(STL_INFORM_INFO)); - BSWAP_STL_INFORM_INFO(dst); -#endif + if (!cmask) { + snprintf(buf, 80, "-"); + } else { + buf[0] = '\0'; + } } -#include "iba/public/ipackoff.h" - #if defined (__cplusplus) -}; +} +#endif #endif - -#endif /* __IBA_STL_MAD_H__ */ - diff --git a/IbAccess/Common/Inc/stl_pa.h b/IbAccess/Common/Inc/stl_pa_priv.h similarity index 55% rename from IbAccess/Common/Inc/stl_pa.h rename to IbAccess/Common/Inc/stl_pa_priv.h index f178dfb9..3fbd7c26 100644 --- a/IbAccess/Common/Inc/stl_pa.h +++ b/IbAccess/Common/Inc/stl_pa_priv.h @@ -29,730 +29,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* [ICS VERSION STRING: unknown] */ -#ifndef _IBA_STL_PA_H_ -#define _IBA_STL_PA_H_ (1) /* suppress duplicate loading of this file */ +#ifndef _STL_PA_PRIV_H_ +#define _STL_PA_PRIV_H_ (1) /* suppress duplicate loading of this file */ -#include "iba/public/datatypes.h" -#include "iba/public/ibyteswap.h" -#include "iba/ib_generalServices.h" -#include "iba/ib_pa.h" -#include "iba/stl_pm.h" +#include "iba/stl_pa_types.h" +#include "iba/stl_mad_types.h" #ifdef __cplusplus extern "C" { #endif -#include "iba/public/ipackon.h" - -// XML Defines -#define STL_PM_MAX_DG_PER_PMPG 5 //Maximum number of Monitors allowed in a PmPortGroup - -/** PA MAD Payloads */ -#define STL_PM_GROUPNAMELEN 64 -#define STL_PM_NODEDESCLEN 64 -#define STL_PM_MAX_GROUPS 10 -#define STL_PM_VFNAMELEN 64 -#define STL_PM_MAX_VFS 32 - -#define STL_PM_UTIL_GRAN_PERCENT 10 /* granularity of utilization buckets */ -#define STL_PM_UTIL_BUCKETS (100 / STL_PM_UTIL_GRAN_PERCENT) - -#define STL_PM_CAT_GRAN_PERCENT 25 /* granularity of error buckets */ -#define STL_PM_CATEGORY_BUCKETS ((100 / STL_PM_CAT_GRAN_PERCENT) + 1) // extra bucket is for those over threshold - -/* ClassPortInfo Capability bits */ - -typedef STL_FIELDUNION3(STL_PA_CLASS_PORT_INFO_CAPABILITY_MASK, 16, - Reserved1: 7, /* start of class dependent bits */ - IsAbsTimeQuerySupported: 1, /* RO - PA supports queries */ - /* w/ absoluteTime in Image ID */ - Reserved2: 8); /* class independent bits*/ - -/* - *PA capability mask defines - */ -#define STL_PA_CPI_CAPMASK_ABSTIMEQUERY 0x0100 - -static __inline void -StlPaClassPortInfoCapMask(char buf[80], uint16 cmask) -{ - if (!cmask) { - snprintf(buf, 80, "-"); - } else { - snprintf(buf, 80, "%s%s%s%s", - (cmask & STL_CLASS_PORT_CAPMASK_TRAP) ? "Trap " : "", - (cmask & STL_CLASS_PORT_CAPMASK_NOTICE) ? "Notice " : "", - (cmask & STL_CLASS_PORT_CAPMASK_CM2) ? "CapMask2 " : "", - /* Class Specific */ - (cmask & STL_PA_CPI_CAPMASK_ABSTIMEQUERY) ? "AbsTime " : ""); - } -} -static __inline void -StlPaClassPortInfoCapMask2(char buf[80], uint32 cmask) -{ - if (!cmask) { - snprintf(buf, 80, "-"); - } else { - buf[0] = '\0'; - } -} - -typedef struct _STL_PA_Group_List { - char groupName[STL_PM_GROUPNAMELEN]; // \0 terminated - actual number indicated by numGroups -} PACK_SUFFIX STL_PA_GROUP_LIST; - -#define PACLIENT_IMAGE_CURRENT 0 // imageNumber of most recent sweep image -#define PACLIENT_IMAGE_TIMED -1 // imageNumber of Image with particular time - -typedef struct _STL_PA_Image_ID_Data { - uint64 imageNumber; - int32 imageOffset; - union { - uint32 absoluteTime; - int32 timeOffset; - } PACK_SUFFIX imageTime; -} PACK_SUFFIX STL_PA_IMAGE_ID_DATA; - -/* Utilization statistical summary */ -typedef struct _STL_PA_PM_Util_Stats { - uint64 totalMBps; /* MB per sec */ - uint64 totalKPps; /* K pkts per sec */ - uint32 avgMBps; - uint32 minMBps; - uint32 maxMBps; - uint32 numBWBuckets; - uint32 BWBuckets[STL_PM_UTIL_BUCKETS]; - uint32 avgKPps; - uint32 minKPps; - uint32 maxKPps; - uint16 pmaNoRespPorts; - uint16 topoIncompPorts; -} PACK_SUFFIX STL_PA_PM_UTIL_STATS; - -/* Error statistical summary */ -typedef struct _STL_PA_PM_CATEGORY_SUMMARY { - uint32 integrityErrors; - uint32 congestion; - uint32 smaCongestion; - uint32 bubble; - uint32 securityErrors; - uint32 routingErrors; - - uint16 utilizationPct10; /* in units of 10% */ - uint16 discardsPct10; /* in units of 10% */ - uint16 reserved[6]; -} PACK_SUFFIX STL_PA_PM_CATEGORY_SUMMARY; - -typedef struct _STL_PM_CATEGORY_THRESHOLD { - uint32 integrityErrors; - uint32 congestion; - uint32 smaCongestion; - uint32 bubble; - uint32 securityErrors; - uint32 routingErrors; -} PACK_SUFFIX STL_PM_CATEGORY_THRESHOLD; - -typedef struct _STL_PM_CATEGORY_BUCKET { - uint32 integrityErrors; - uint32 congestion; - uint32 smaCongestion; - uint32 bubble; - uint32 securityErrors; - uint32 routingErrors; -} PACK_SUFFIX STL_PM_CATEGORY_BUCKET; - -typedef struct _STL_PM_CATEGORY_STATS { - STL_PA_PM_CATEGORY_SUMMARY categoryMaximums; - STL_PM_CATEGORY_BUCKET ports[STL_PM_CATEGORY_BUCKETS]; -} PACK_SUFFIX STL_PM_CATEGORY_STATS; - -typedef struct _STL_PA_Group_Info_Data { - char groupName[STL_PM_GROUPNAMELEN]; // \0 terminated. - STL_PA_IMAGE_ID_DATA imageId; - uint32 numInternalPorts; - uint32 numExternalPorts; - STL_PA_PM_UTIL_STATS internalUtilStats; - STL_PA_PM_UTIL_STATS sendUtilStats; - STL_PA_PM_UTIL_STATS recvUtilStats; - STL_PM_CATEGORY_STATS internalCategoryStats; - STL_PM_CATEGORY_STATS externalCategoryStats; - uint8 maxInternalRate; - uint8 minInternalRate; - uint8 maxExternalRate; - uint8 minExternalRate; - uint32 maxInternalMBps; - uint32 maxExternalMBps; -} PACK_SUFFIX STL_PA_PM_GROUP_INFO_DATA; - -typedef struct _STL_PA_Group_Cfg_Req { - char groupName[STL_PM_GROUPNAMELEN]; // \0 terminated. - STL_PA_IMAGE_ID_DATA imageId; -} PACK_SUFFIX STL_PA_PM_GROUP_CFG_REQ; - -typedef struct _STL_PA_Group_Cfg_Rsp { - STL_PA_IMAGE_ID_DATA imageId; - uint64 nodeGUID; - char nodeDesc[STL_PM_NODEDESCLEN]; // \0 terminated. - uint32 nodeLid; - uint8 portNumber; - uint8 reserved[3]; -} PACK_SUFFIX STL_PA_PM_GROUP_CFG_RSP; - - -// STL_PORT_COUNTERS_DATA.flags -#define STL_PA_PC_FLAG_DELTA 0x00000001 // are these DELTA(1) or running totals -#define STL_PA_PC_FLAG_UNEXPECTED_CLEAR 0x00000002 // was there an unexpected clear -#define STL_PA_PC_FLAG_SHARED_VL 0x00000004 // for vf port counters, vl is shared >1 vf -#define STL_PA_PC_FLAG_USER_COUNTERS 0x00000008 // for PA user controlled running counters - -typedef struct _STL_PORT_COUNTERS_DATA { - uint32 nodeLid; - uint8 portNumber; - uint8 reserved[3]; - uint32 flags; - uint32 reserved1; - uint64 reserved3; - STL_PA_IMAGE_ID_DATA imageId; - uint64 portXmitData; - uint64 portRcvData; - uint64 portXmitPkts; - uint64 portRcvPkts; - uint64 portMulticastXmitPkts; - uint64 portMulticastRcvPkts; - uint64 localLinkIntegrityErrors; - uint64 fmConfigErrors; - uint64 portRcvErrors; - uint64 excessiveBufferOverruns; - uint64 portRcvConstraintErrors; - uint64 portRcvSwitchRelayErrors; - uint64 portXmitDiscards; - uint64 portXmitConstraintErrors; - uint64 portRcvRemotePhysicalErrors; - uint64 swPortCongestion; - uint64 portXmitWait; - uint64 portRcvFECN; - uint64 portRcvBECN; - uint64 portXmitTimeCong; - uint64 portXmitWastedBW; - uint64 portXmitWaitData; - uint64 portRcvBubble; - uint64 portMarkFECN; - uint32 linkErrorRecovery; - uint32 linkDowned; - uint8 uncorrectableErrors; - union { - uint8 AsReg8; - struct { IB_BITFIELD3(uint8, - numLanesDown : 4, - reserved : 1, - linkQualityIndicator : 3) - } PACK_SUFFIX s; - } lq; - uint8 reserved2[6]; -} PACK_SUFFIX STL_PORT_COUNTERS_DATA; - -typedef struct _STL_CLR_PORT_COUNTERS_DATA { - uint32 NodeLid; - uint8 PortNumber; - uint8 Reserved[3]; - uint64 Reserved2; - CounterSelectMask_t CounterSelectMask; -} PACK_SUFFIX STL_CLR_PORT_COUNTERS_DATA; - -typedef struct _STL_CLR_ALL_PORT_COUNTERS_DATA { - CounterSelectMask_t CounterSelectMask; -} PACK_SUFFIX STL_CLR_ALL_PORT_COUNTERS_DATA; - -typedef struct _STL_INTEGRITY_WEIGHTS { - uint8 LocalLinkIntegrityErrors; - uint8 PortRcvErrors; - uint8 ExcessiveBufferOverruns; - uint8 LinkErrorRecovery; - uint8 LinkDowned; - uint8 UncorrectableErrors; - uint8 FMConfigErrors; - uint8 LinkQualityIndicator; - uint8 LinkWidthDowngrade; - uint8 reserved[7]; -} PACK_SUFFIX STL_INTEGRITY_WEIGHTS_T; - -typedef struct _STL_PM_CATEGORY_THRESHOLDS { - uint32 integrityErrors; - uint32 congestion; - uint32 smaCongestion; - uint32 bubble; - uint32 securityErrors; - uint32 routingErrors; -} PACK_SUFFIX STL_PM_CATEGORY_THRESHOLDS; - -typedef struct _STL_CONGESTION_WEIGHTS { - uint8 PortXmitWait; - uint8 SwPortCongestion; - uint8 PortRcvFECN; - uint8 PortRcvBECN; - uint8 PortXmitTimeCong; - uint8 PortMarkFECN; - uint16 reserved; -} PACK_SUFFIX STL_CONGESTION_WEIGHTS_T; - -// PM configuration flags for pmFlags below -#define STL_PM_NONE 0 -#define STL_PM_PROCESS_VL_COUNTERS 0x000000001 // Enable Processing of VL Counters -#define STL_PM_PROCESS_HFI_COUNTERS 0x000000002 // Enable Processing of HFI Counters -#define STL_PM_PROCESS_CLR_DATA_COUNTERS 0x000000004 // Enable Clearing of Data Counters -#define STL_PM_PROCESS_CLR_64BIT_COUNTERS 0x000000008 // Enable Clearing of 64 bit Error Counters -#define STL_PM_PROCESS_CLR_32BIT_COUNTERS 0x000000010 // Enable Clearing of 32 bit Error Counters -#define STL_PM_PROCESS_CLR_8BIT_COUNTERS 0x000000020 // Enable Clearing of 8 bit Error Counters - -static __inline -void StlFormatPmFlags(char buf[80], uint32 pmFlags) -{ - snprintf(buf, 80, "%s=%s %s=%s %s=%s %s=%s", - "ProcessHFICntrs", pmFlags & STL_PM_PROCESS_HFI_COUNTERS ? "On" : "Off", - "ProcessVLCntrs", pmFlags & STL_PM_PROCESS_VL_COUNTERS ? "On" : "Off", - "ClrDataCntrs", pmFlags & STL_PM_PROCESS_CLR_DATA_COUNTERS ? "On" : "Off", - "Clr64bitErrCntrs", pmFlags & STL_PM_PROCESS_CLR_64BIT_COUNTERS ? "On" : "Off"); -} - -static __inline -void StlFormatPmFlags2(char buf[80], uint32 pmFlags) -{ - snprintf(buf, 80, "%s=%s %s=%s", - "Clr32bitErrCntrs", pmFlags & STL_PM_PROCESS_CLR_32BIT_COUNTERS ? "On" : "Off", - "Clr8bitErrCntrs", pmFlags & STL_PM_PROCESS_CLR_8BIT_COUNTERS ? "On" : "Off"); -} - -typedef struct _STL_PA_PM_Cfg_Data { - uint32 sweepInterval; - uint32 maxClients; - uint32 sizeHistory; - uint32 sizeFreeze; - uint32 lease; - uint32 pmFlags; - STL_CONGESTION_WEIGHTS_T congestionWeights; - STL_PM_CATEGORY_THRESHOLDS categoryThresholds; - STL_INTEGRITY_WEIGHTS_T integrityWeights; - uint64 memoryFootprint; - uint32 maxAttempts; - uint32 respTimeout; - uint32 minRespTimeout; - uint32 maxParallelNodes; - uint32 pmaBatchSize; - uint8 errorClear; - uint8 reserved[3]; -} PACK_SUFFIX STL_PA_PM_CFG_DATA; - -typedef struct _STL_MOVE_FREEZE_DATA { - STL_PA_IMAGE_ID_DATA oldFreezeImage; - STL_PA_IMAGE_ID_DATA newFreezeImage; -} PACK_SUFFIX STL_MOVE_FREEZE_DATA; - -#define STL_PA_SELECT_UTIL_HIGH 0x00020001 // highest first, descending -#define STL_PA_SELECT_UTIL_MC_HIGH 0x00020081 -#define STL_PA_SELECT_UTIL_PKTS_HIGH 0x00020082 -#define STL_PA_SELECT_UTIL_LOW 0x00020101 // lowest first, ascending -#define STL_PA_SELECT_UTIL_MC_LOW 0x00020102 -#define STL_PA_SELECT_CATEGORY_INTEG 0x00030001 // hightest first, descending -#define STL_PA_SELECT_CATEGORY_CONG 0x00030002 -#define STL_PA_SELECT_CATEGORY_SMA_CONG 0x00030003 -#define STL_PA_SELECT_CATEGORY_BUBBLE 0x00030004 -#define STL_PA_SELECT_CATEGORY_SEC 0x00030005 -#define STL_PA_SELECT_CATEGORY_ROUT 0x00030006 - -typedef struct _STL_FOCUS_PORTS_REQ { - char groupName[STL_PM_GROUPNAMELEN]; // \0 terminated - STL_PA_IMAGE_ID_DATA imageId; - uint32 select; - uint32 start; - uint32 range; -} PACK_SUFFIX STL_FOCUS_PORTS_REQ; - -#define STL_PA_FOCUS_STATUS_OK 0 -#define STL_PA_FOCUS_STATUS_PMA_IGNORE 1 -#define STL_PA_FOCUS_STATUS_PMA_FAILURE 2 -#define STL_PA_FOCUS_STATUS_TOPO_FAILURE 3 - -static __inline -const char* StlFocusStatusToText(uint8 status) -{ - switch (status) { - case STL_PA_FOCUS_STATUS_OK: return "OK"; - case STL_PA_FOCUS_STATUS_PMA_IGNORE: return "PMA Ignore"; - case STL_PA_FOCUS_STATUS_PMA_FAILURE: return "PMA Failure"; - case STL_PA_FOCUS_STATUS_TOPO_FAILURE: return "Topo Failure"; - default: return "Unknown"; - } -} - -typedef struct _STL_FOCUS_PORTS_RSP { - STL_PA_IMAGE_ID_DATA imageId; - uint32 nodeLid; - uint8 portNumber; - uint8 rate; // IB_STATIC_RATE - 5 bit value - uint8 maxVlMtu; // enum IB_MTU - 4 bit value - IB_BITFIELD2(uint8, localStatus : 4, - neighborStatus : 4) - uint64 value; // list sorting factor - uint64 nodeGUID; - char nodeDesc[STL_PM_NODEDESCLEN]; // \0 terminated. - uint32 neighborLid; - uint8 neighborPortNumber; - uint8 reserved3[3]; - uint64 neighborValue; - uint64 neighborGuid; - char neighborNodeDesc[STL_PM_NODEDESCLEN]; // \0 terminated. -} PACK_SUFFIX STL_FOCUS_PORTS_RSP; - -typedef struct _STL_SMINFO_DATA { - STL_LID_32 lid; - IB_BITFIELD2(uint8, - priority : 4, - state : 4) - uint8 portNumber; - uint16 reserved; - uint64 smPortGuid; - char smNodeDesc[64]; // can be 64 char w/o \0 -} PACK_SUFFIX STL_SMINFO_DATA; - -typedef struct _STL_PA_IMAGE_INFO_DATA { - STL_PA_IMAGE_ID_DATA imageId; - uint64 sweepStart; - uint32 sweepDuration; - uint16 numHFIPorts; - uint16 reserved3; - uint16 reserved; - uint16 numSwitchNodes; - uint32 numSwitchPorts; - uint32 numLinks; - uint32 numSMs; - uint32 numNoRespNodes; - uint32 numNoRespPorts; - uint32 numSkippedNodes; - uint32 numSkippedPorts; - uint32 numUnexpectedClearPorts; - uint32 imageInterval; - STL_SMINFO_DATA SMInfo[2]; -} PACK_SUFFIX STL_PA_IMAGE_INFO_DATA; - -typedef struct _STL_PA_VF_LIST { - char vfName[STL_PM_VFNAMELEN]; // \0 terminated -} PACK_SUFFIX STL_PA_VF_LIST; - -typedef struct _STL_PA_VF_INFO_DATA { - char vfName[STL_PM_VFNAMELEN]; // \0 terminated - uint64 reserved; - STL_PA_IMAGE_ID_DATA imageId; - uint32 numPorts; - STL_PA_PM_UTIL_STATS internalUtilStats; - STL_PM_CATEGORY_STATS internalCategoryStats; - // these are added at the end to allow for forward and backward - // compatibility. - uint8 maxInternalRate; - uint8 minInternalRate; - uint32 maxInternalMBps; -} PACK_SUFFIX STL_PA_VF_INFO_DATA; - -typedef struct _STL_PA_VF_Cfg_Req { - char vfName[STL_PM_VFNAMELEN]; // \0 terminated - uint64 reserved; - STL_PA_IMAGE_ID_DATA imageId; -} PACK_SUFFIX STL_PA_VF_CFG_REQ; - -typedef struct _STL_PA_VF_Cfg_Rsp { - STL_PA_IMAGE_ID_DATA imageId; - uint64 nodeGUID; - char nodeDesc[STL_PM_NODEDESCLEN]; // \0 terminated. - uint32 nodeLid; - uint8 portNumber; - uint8 reserved[3]; -} PACK_SUFFIX STL_PA_VF_CFG_RSP; - -typedef struct _STL_PA_VF_PORT_COUNTERS_DATA { - uint32 nodeLid; - uint8 portNumber; - uint8 reserved[3]; - uint32 flags; - uint32 reserved1; - uint64 reserved3; - char vfName[STL_PM_VFNAMELEN]; // \0 terminated - uint64 reserved2; - STL_PA_IMAGE_ID_DATA imageId; - uint64 portVFXmitData; - uint64 portVFRcvData; - uint64 portVFXmitPkts; - uint64 portVFRcvPkts; - uint64 portVFXmitDiscards; - uint64 swPortVFCongestion; - uint64 portVFXmitWait; - uint64 portVFRcvFECN; - uint64 portVFRcvBECN; - uint64 portVFXmitTimeCong; - uint64 portVFXmitWastedBW; - uint64 portVFXmitWaitData; - uint64 portVFRcvBubble; - uint64 portVFMarkFECN; -} PACK_SUFFIX STL_PA_VF_PORT_COUNTERS_DATA; - -typedef union { - uint32 AsReg32; - struct { IB_BITFIELD15(uint32, - PortVLXmitData : 1, - PortVLRcvData : 1, - PortVLXmitPkts : 1, - PortVLRcvPkts : 1, - PortVLXmitDiscards : 1, - SwPortVLCongestion : 1, - PortVLXmitWait : 1, - PortVLRcvFECN : 1, - PortVLRcvBECN : 1, - PortVLXmitTimeCong : 1, - PortVLXmitWastedBW : 1, - PortVLXmitWaitData : 1, - PortVLRcvBubble : 1, - PortVLMarkFECN : 1, - reserved : 18) - } PACK_SUFFIX s; -} STLVlCounterSelectMask; - -typedef struct _STL_PA_CLEAR_VF_PORT_COUNTERS_DATA { - uint32 nodeLid; - uint8 portNumber; - uint8 reserved[3]; - uint64 reserved4; - char vfName[STL_PM_VFNAMELEN]; // \0 terminated - uint64 reserved3; - STLVlCounterSelectMask vfCounterSelectMask; - uint32 reserved2; -} PACK_SUFFIX STL_PA_CLEAR_VF_PORT_COUNTERS_DATA; - -typedef struct _STL_PA_VF_FOCUS_PORTS_REQ { - char vfName[STL_PM_VFNAMELEN]; // \0 terminated - uint64 reserved; - STL_PA_IMAGE_ID_DATA imageId; - uint32 select; - uint32 start; - uint32 range; -} PACK_SUFFIX STL_PA_VF_FOCUS_PORTS_REQ; - -typedef struct _STL_PA_VF_FOCUS_PORTS_RSP { - STL_PA_IMAGE_ID_DATA imageId; - uint32 nodeLid; - uint8 portNumber; - uint8 rate; // IB_STATIC_RATE - 5 bit value - uint8 maxVlMtu; // enum IB_MTU - 4 bit value - IB_BITFIELD2(uint8, localStatus : 4, - neighborStatus : 4) - uint64 value; // list sorting factor - uint64 nodeGUID; - char nodeDesc[STL_PM_NODEDESCLEN]; // \0 terminated. - uint32 neighborLid; - uint8 neighborPortNumber; - uint8 reserved3[3]; - uint64 neighborValue; - uint64 neighborGuid; - char neighborNodeDesc[STL_PM_NODEDESCLEN]; // \0 terminated. -} PACK_SUFFIX STL_PA_VF_FOCUS_PORTS_RSP; - -/* End of packed data structures */ -#include "iba/public/ipackoff.h" - - - -/* Performance Analysis methods */ -#define STL_PA_CMD_GET (0x01) -#define STL_PA_CMD_SET (0x02) -#define STL_PA_CMD_GET_RESP (0x81) -#define STL_PA_CMD_GETTABLE (0x12) -#define STL_PA_CMD_GETTABLE_RESP (0x92) - - -#define MAD_STL_PA_REPLY 0x80 // Reply bit for methods - -/* Performance Analysis attribute IDs */ - -#define STL_PA_ATTRID_GET_CLASSPORTINFO 0x01 -#define STL_PA_ATTRID_GET_GRP_LIST 0xA0 -#define STL_PA_ATTRID_GET_GRP_INFO 0xA1 -#define STL_PA_ATTRID_GET_GRP_CFG 0xA2 -#define STL_PA_ATTRID_GET_PORT_CTRS 0xA3 -#define STL_PA_ATTRID_CLR_PORT_CTRS 0xA4 -#define STL_PA_ATTRID_CLR_ALL_PORT_CTRS 0xA5 -#define STL_PA_ATTRID_GET_PM_CONFIG 0xA6 -#define STL_PA_ATTRID_FREEZE_IMAGE 0xA7 -#define STL_PA_ATTRID_RELEASE_IMAGE 0xA8 -#define STL_PA_ATTRID_RENEW_IMAGE 0xA9 -#define STL_PA_ATTRID_GET_FOCUS_PORTS 0xAA -#define STL_PA_ATTRID_GET_IMAGE_INFO 0xAB -#define STL_PA_ATTRID_MOVE_FREEZE_FRAME 0xAC -#define STL_PA_ATTRID_GET_VF_LIST 0xAD -#define STL_PA_ATTRID_GET_VF_INFO 0xAE -#define STL_PA_ATTRID_GET_VF_CONFIG 0xAF -#define STL_PA_ATTRID_GET_VF_PORT_CTRS 0xB0 -#define STL_PA_ATTRID_CLR_VF_PORT_CTRS 0xB1 -#define STL_PA_ATTRID_GET_VF_FOCUS_PORTS 0xB2 - -/* Performance Analysis MAD status values */ - -#define STL_MAD_STATUS_STL_PA_UNAVAILABLE 0x0A00 // Engine unavailable -#define STL_MAD_STATUS_STL_PA_NO_GROUP 0x0B00 // No such group -#define STL_MAD_STATUS_STL_PA_NO_PORT 0x0C00 // Port not found -#define STL_MAD_STATUS_STL_PA_NO_VF 0x0D00 // VF not found -#define STL_MAD_STATUS_STL_PA_INVALID_PARAMETER 0x0E00 // Invalid parameter -#define STL_MAD_STATUS_STL_PA_NO_IMAGE 0x0F00 // Image not found - -/* PM Service Record values */ - -#define STL_PM_SERVICE_NAME "Intel Performance Manager service Rev 1.0" -#define STL_PM_SERVICE_ID (0x1100d03c34845555ull) -#define STL_PM_VERSION 0x01 -#define STL_PM_MASTER 0x01 /* master state */ -#define STL_PM_STANDBY 0x02 /* standby state */ - -#define STL_PA_DATA_OFFSET 32 - -#define STL_PA_CLASS_VERSION 0x80 - - -/* Performance Analysis Response Structures */ -#define STL_PA_IMAGE_ID_NSIZE sizeof(STL_PA_IMAGE_ID_DATA) -#define STL_PA_REC_DESC_LEN 64 -#define STL_PA_TABLE_REC_DATA_LEN 512 -#define STL_PA_RECORD_NSIZE sizeof(StlPaRecord_t) -#define STL_PA_TABLE_RECORD_NSIZE sizeof(StlPaTableRecord_t) -#define STL_PA_GROUP_LIST_NSIZE sizeof(STL_PA_GROUP_LIST) -#define STL_PA_GROUP_INFO_NSIZE sizeof(STL_PA_PM_GROUP_INFO_DATA) -#define STL_PA_GROUP_CONFIG_NSIZE sizeof(STL_PA_PM_GROUP_CFG_RSP) -#define STL_PA_PORT_COUNTERS_NSIZE sizeof(STL_PORT_COUNTERS_DATA) -#define STL_PA_CLR_PORT_COUNTERS_NSIZE sizeof(STL_CLR_PORT_COUNTERS_DATA) -#define STL_PA_CLR_ALL_PORT_COUNTERS_NSIZE sizeof(STL_CLR_ALL_PORT_COUNTERS_DATA) -#define STL_PA_PM_CONFIG_NSIZE sizeof(STL_PA_PM_CFG_DATA) -#define STL_PA_FOCUS_PORTS_NSIZE sizeof(STL_FOCUS_PORTS_RSP) -#define STL_PA_IMAGE_INFO_NSIZE sizeof(STL_PA_IMAGE_INFO_DATA) -#define STL_PA_MOVE_FREEZE_NSIZE sizeof(STL_MOVE_FREEZE_DATA) -#define STL_PA_VF_LIST_NSIZE sizeof(STL_PA_VF_LIST) -#define STL_PA_VF_INFO_NSIZE sizeof(STL_PA_VF_INFO_DATA) -#define STL_PA_VF_CONFIG_NSIZE sizeof(STL_PA_VF_CFG_RSP) -#define STL_PA_VF_PORT_COUNTERS_NSIZE sizeof(STL_PA_VF_PORT_COUNTERS_DATA) -#define STL_PA_CLR_VF_PORT_COUNTERS_NSIZE sizeof(STL_PA_CLEAR_VF_PORT_COUNTERS_DATA) -#define STL_PA_VF_FOCUS_PORTS_NSIZE sizeof(STL_PA_VF_FOCUS_PORTS_RSP) - -typedef struct StlPaRecord_s { - uint16_t fieldUint16; - uint16_t fieldFiller; - uint32_t fieldUint32; - uint64_t fieldUint64; - uint8_t desc[STL_PA_REC_DESC_LEN]; -} StlPaRecord_t; - -typedef struct StlPaTableRecord_s { - uint16_t fieldUint16; - uint16_t fieldFiller; - uint32_t fieldUint32; - uint64_t fieldUint64; - uint8_t desc[STL_PA_REC_DESC_LEN]; - uint8_t data[STL_PA_TABLE_REC_DATA_LEN]; -} StlPaTableRecord_t; - -typedef struct _STL_PA_TABLE_RECORD_RESULTS { - uint32 NumPaRecords; /* Number of PA Records returned */ - PaTableRecord_t PaRecords[1]; /* list of PA records returned */ -} STL_PA_TABLE_RECORD_RESULTS, *PSTL_PA_TABLE_RECORD_RESULTS; - -typedef struct _STL_PA_GROUP_LIST_RESULTS { - uint32 NumGroupListRecords; /* Number of PA Records returned */ - STL_PA_GROUP_LIST GroupListRecords[1]; /* list of PA records returned */ -} STL_PA_GROUP_LIST_RESULTS, *PSTL_PA_GROUP_LIST_RESULTS; - -typedef struct _STL_PA_GROUP_INFO_RESULTS { - uint32 NumGroupInfoRecords; /* Number of PA Records returned */ - STL_PA_PM_GROUP_INFO_DATA GroupInfoRecords[1]; /* list of PA records returned */ -} STL_PA_GROUP_INFO_RESULTS, *PSTL_PA_GROUP_INFO_RESULTS; - -typedef struct _STL_PA_GROUP_CONFIG_RESULTS { - uint32 NumGroupConfigRecords; /* Number of PA Records returned */ - STL_PA_PM_GROUP_CFG_RSP GroupConfigRecords[1]; /* list of PA records returned */ -} STL_PA_GROUP_CONFIG_RESULTS, *PSTL_PA_GROUP_CONFIG_RESULTS; - -typedef struct _STL_PA_PORT_COUNTERS_RESULTS { - uint32 NumPortCountersRecords; /* Number of PA Records returned */ - STL_PORT_COUNTERS_DATA PortCountersRecords[1]; /* list of PA records returned */ -} STL_PA_PORT_COUNTERS_RESULTS, *PSTL_PA_PORT_COUNTERS_RESULTS; - -typedef struct _STL_PA_CLR_PORT_COUNTERS_RESULTS { - uint32 NumClrPortCountersRecords; /* Number of PA Records returned */ - STL_CLR_PORT_COUNTERS_DATA ClrPortCountersRecords[1]; /* list of PA records returned */ -} STL_PA_CLR_PORT_COUNTERS_RESULTS, *PSTL_PA_CLR_PORT_COUNTERS_RESULTS; - -typedef struct _STL_PA_CLR_ALL_PORT_COUNTERS_RESULTS { - uint32 NumClrAllPortCountersRecords; /* Number of PA Records returned */ - STL_CLR_ALL_PORT_COUNTERS_DATA ClrAllPortCountersRecords[1]; /* list of PA records returned */ -} STL_PA_CLR_ALL_PORT_COUNTERS_RESULTS, *PSTL_PA_CLR_ALL_PORT_COUNTERS_RESULTS; - -typedef struct _STL_PA_PM_CONFIG_RESULTS { - uint32 NumPmConfigRecords; /* Number of PA Records returned */ - STL_PA_PM_CFG_DATA PmConfigRecords[1]; /* list of PA records returned */ -} STL_PA_PM_CONFIG_RESULTS, *PSTL_PA_PM_CONFIG_RESULTS; - -typedef struct _STL_PA_IMAGE_ID_RESULTS { - uint32 NumImageIDRecords; /* Number of PA Records returned */ - STL_PA_IMAGE_ID_DATA ImageIDRecords[1]; /* list of PA records returned */ -} STL_PA_IMAGE_ID_RESULTS, *PSTL_PA_IMAGE_ID_RESULTS; - -typedef struct _STL_PA_FOCUS_PORTS_RESULTS { - uint32 NumFocusPortsRecords; /* Number of PA Records returned */ - STL_FOCUS_PORTS_RSP FocusPortsRecords[1]; /* list of PA records returned */ -} STL_PA_FOCUS_PORTS_RESULTS, *PSTL_PA_FOCUS_PORTS_RESULTS; - -typedef struct _STL_PA_IMAGE_INFO_RESULTS { - uint32 NumImageInfoRecords; /* Number of PA Records returned */ - STL_PA_IMAGE_INFO_DATA ImageInfoRecords[1]; /* list of PA records returned */ -} STL_PA_IMAGE_INFO_RESULTS, *PSTL_PA_IMAGE_INFO_RESULTS; - -typedef struct _STL_MOVE_FREEZE_RESULTS { - uint32 NumMoveFreezeRecords; /* Number of PA Records returned */ - STL_MOVE_FREEZE_DATA MoveFreezeRecords[1]; /* list of PA records returned */ -} STL_MOVE_FREEZE_RESULTS, *PSTL_PA_MOVE_FREEZE_RESULTS; - -typedef struct _STL_PA_VF_LIST_RESULTS { - uint32 NumVFListRecords; /* Number of PA Records returned */ - STL_PA_VF_LIST VFListRecords[1]; /* list of PA records returned */ -} STL_PA_VF_LIST_RESULTS, *PSTL_PA_VF_LIST_RESULTS; - -typedef struct _STL_PA_VF_INFO_RESULTS { - uint32 NumVFInfoRecords; /* Number of PA Records returned */ - STL_PA_VF_INFO_DATA VFInfoRecords[1]; /* list of PA records returned */ -} STL_PA_VF_INFO_RESULTS, *PSTL_PA_VF_INFO_RESULTS; - -typedef struct _STL_PA_VF_CONFIG_RESULTS { - uint32 NumVFConfigRecords; /* Number of PA Records returned */ - STL_PA_VF_CFG_RSP VFConfigRecords[1]; /* list of PA records returned */ -} STL_PA_VF_CONFIG_RESULTS, *PSTL_PA_VF_CONFIG_RESULTS; - -typedef struct _STL_PA_VF_FOCUS_PORTS_RESULTS { - uint32 NumVFFocusPortsRecords; /* Number of PA Records returned */ - STL_PA_VF_FOCUS_PORTS_RSP FocusPortsRecords[1]; /* list of PA records returned */ -} STL_PA_VF_FOCUS_PORTS_RESULTS, *PSTL_PA_VF_FOCUS_PORTS_RESULTS; - -static __inline void -BSWAP_STL_PA_RECORD(StlPaRecord_t *pRecord) -{ -#if CPU_LE - pRecord->fieldUint16 = ntoh16(pRecord->fieldUint16); - pRecord->fieldUint32 = ntoh32(pRecord->fieldUint32); - pRecord->fieldUint64 = ntoh64(pRecord->fieldUint64); -#endif /* CPU_LE */ -} - -static __inline void -BSWAP_STL_PA_TABLE_RECORD(StlPaTableRecord_t *pRecord) -{ -#if CPU_LE - pRecord->fieldUint16 = ntoh16(pRecord->fieldUint16); - pRecord->fieldUint32 = ntoh32(pRecord->fieldUint32); - pRecord->fieldUint64 = ntoh64(pRecord->fieldUint64); -#endif /* CPU_LE */ -} - static __inline void BSWAP_STL_PA_IMAGE_ID(STL_PA_IMAGE_ID_DATA *pRecord) { @@ -1154,8 +440,88 @@ BSWAP_STL_PA_VF_FOCUS_PORTS_RSP(STL_PA_VF_FOCUS_PORTS_RSP *pRecord) #endif /* CPU_LE */ } +/* Performance Analysis Response Structures */ +typedef struct _STL_PA_GROUP_LIST_RESULTS { + uint32 NumGroupListRecords; /* Number of PA Records returned */ + STL_PA_GROUP_LIST GroupListRecords[1]; /* list of PA records returned */ +} STL_PA_GROUP_LIST_RESULTS, *PSTL_PA_GROUP_LIST_RESULTS; + +typedef struct _STL_PA_GROUP_INFO_RESULTS { + uint32 NumGroupInfoRecords; /* Number of PA Records returned */ + STL_PA_PM_GROUP_INFO_DATA GroupInfoRecords[1]; /* list of PA records returned */ +} STL_PA_GROUP_INFO_RESULTS, *PSTL_PA_GROUP_INFO_RESULTS; + +typedef struct _STL_PA_GROUP_CONFIG_RESULTS { + uint32 NumGroupConfigRecords; /* Number of PA Records returned */ + STL_PA_PM_GROUP_CFG_RSP GroupConfigRecords[1]; /* list of PA records returned */ +} STL_PA_GROUP_CONFIG_RESULTS, *PSTL_PA_GROUP_CONFIG_RESULTS; + +typedef struct _STL_PA_PORT_COUNTERS_RESULTS { + uint32 NumPortCountersRecords; /* Number of PA Records returned */ + STL_PORT_COUNTERS_DATA PortCountersRecords[1]; /* list of PA records returned */ +} STL_PA_PORT_COUNTERS_RESULTS, *PSTL_PA_PORT_COUNTERS_RESULTS; + +typedef struct _STL_PA_CLR_PORT_COUNTERS_RESULTS { + uint32 NumClrPortCountersRecords; /* Number of PA Records returned */ + STL_CLR_PORT_COUNTERS_DATA ClrPortCountersRecords[1]; /* list of PA records returned */ +} STL_PA_CLR_PORT_COUNTERS_RESULTS, *PSTL_PA_CLR_PORT_COUNTERS_RESULTS; + +typedef struct _STL_PA_CLR_ALL_PORT_COUNTERS_RESULTS { + uint32 NumClrAllPortCountersRecords; /* Number of PA Records returned */ + STL_CLR_ALL_PORT_COUNTERS_DATA ClrAllPortCountersRecords[1]; /* list of PA records returned */ +} STL_PA_CLR_ALL_PORT_COUNTERS_RESULTS, *PSTL_PA_CLR_ALL_PORT_COUNTERS_RESULTS; + +typedef struct _STL_PA_PM_CONFIG_RESULTS { + uint32 NumPmConfigRecords; /* Number of PA Records returned */ + STL_PA_PM_CFG_DATA PmConfigRecords[1]; /* list of PA records returned */ +} STL_PA_PM_CONFIG_RESULTS, *PSTL_PA_PM_CONFIG_RESULTS; + +typedef struct _STL_PA_IMAGE_ID_RESULTS { + uint32 NumImageIDRecords; /* Number of PA Records returned */ + STL_PA_IMAGE_ID_DATA ImageIDRecords[1]; /* list of PA records returned */ +} STL_PA_IMAGE_ID_RESULTS, *PSTL_PA_IMAGE_ID_RESULTS; + +typedef struct _STL_PA_FOCUS_PORTS_RESULTS { + uint32 NumFocusPortsRecords; /* Number of PA Records returned */ + STL_FOCUS_PORTS_RSP FocusPortsRecords[1]; /* list of PA records returned */ +} STL_PA_FOCUS_PORTS_RESULTS, *PSTL_PA_FOCUS_PORTS_RESULTS; + +typedef struct _STL_PA_IMAGE_INFO_RESULTS { + uint32 NumImageInfoRecords; /* Number of PA Records returned */ + STL_PA_IMAGE_INFO_DATA ImageInfoRecords[1]; /* list of PA records returned */ +} STL_PA_IMAGE_INFO_RESULTS, *PSTL_PA_IMAGE_INFO_RESULTS; + +typedef struct _STL_MOVE_FREEZE_RESULTS { + uint32 NumMoveFreezeRecords; /* Number of PA Records returned */ + STL_MOVE_FREEZE_DATA MoveFreezeRecords[1]; /* list of PA records returned */ +} STL_MOVE_FREEZE_RESULTS, *PSTL_PA_MOVE_FREEZE_RESULTS; + +typedef struct _STL_PA_VF_LIST_RESULTS { + uint32 NumVFListRecords; /* Number of PA Records returned */ + STL_PA_VF_LIST VFListRecords[1]; /* list of PA records returned */ +} STL_PA_VF_LIST_RESULTS, *PSTL_PA_VF_LIST_RESULTS; + +typedef struct _STL_PA_VF_INFO_RESULTS { + uint32 NumVFInfoRecords; /* Number of PA Records returned */ + STL_PA_VF_INFO_DATA VFInfoRecords[1]; /* list of PA records returned */ +} STL_PA_VF_INFO_RESULTS, *PSTL_PA_VF_INFO_RESULTS; + +typedef struct _STL_PA_VF_CONFIG_RESULTS { + uint32 NumVFConfigRecords; /* Number of PA Records returned */ + STL_PA_VF_CFG_RSP VFConfigRecords[1]; /* list of PA records returned */ +} STL_PA_VF_CONFIG_RESULTS, *PSTL_PA_VF_CONFIG_RESULTS; + +typedef struct _STL_PA_VF_FOCUS_PORTS_RESULTS { + uint32 NumVFFocusPortsRecords; /* Number of PA Records returned */ + STL_PA_VF_FOCUS_PORTS_RSP FocusPortsRecords[1]; /* list of PA records returned */ +} STL_PA_VF_FOCUS_PORTS_RESULTS, *PSTL_PA_VF_FOCUS_PORTS_RESULTS; + +/* PortXmitData and PortRcvData are in units of flits (8 bytes) */ +#define FLITS_PER_MiB ((uint64)1024*(uint64)1024/(uint64)8) +#define FLITS_PER_MB ((uint64)1000*(uint64)1000/(uint64)8) + #ifdef __cplusplus } #endif -#endif /* _IBA_STL_PA_H_ */ +#endif /* _STL_PA_PRIV_H_ */ diff --git a/IbAccess/Common/Inc/stl_pa_types.h b/IbAccess/Common/Inc/stl_pa_types.h new file mode 100644 index 00000000..2679cdf2 --- /dev/null +++ b/IbAccess/Common/Inc/stl_pa_types.h @@ -0,0 +1,658 @@ +/* BEGIN_ICS_COPYRIGHT7 **************************************** + +Copyright (c) 2015-2017, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +** END_ICS_COPYRIGHT7 ****************************************/ + +/* [ICS VERSION STRING: unknown] */ + +#ifndef _STL_PA_TYPES_H_ +#define _STL_PA_TYPES_H_ (1) /* suppress duplicate loading of this file */ + +#include "iba/public/datatypes.h" +#include "iba/public/ibyteswap.h" +#include "iba/stl_mad_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#include "iba/public/ipackon.h" + +// XML Defines +#define STL_PM_MAX_DG_PER_PMPG 5 //Maximum number of Monitors allowed in a PmPortGroup + +/** PA MAD Payloads */ +#define STL_PM_GROUPNAMELEN 64 +#define STL_PM_NODEDESCLEN 64 +#define STL_PM_MAX_GROUPS 10 +#define STL_PM_VFNAMELEN 64 +#define STL_PM_MAX_VFS 32 + +#define STL_PM_UTIL_GRAN_PERCENT 10 /* granularity of utilization buckets */ +#define STL_PM_UTIL_BUCKETS (100 / STL_PM_UTIL_GRAN_PERCENT) + +#define STL_PM_CAT_GRAN_PERCENT 25 /* granularity of error buckets */ +#define STL_PM_CATEGORY_BUCKETS ((100 / STL_PM_CAT_GRAN_PERCENT) + 1) // extra bucket is for those over threshold + +/* ClassPortInfo Capability bits */ + +#define STL_PA_CPI_CAPMASK_ABSTIMEQUERY 0x0100 + +typedef STL_FIELDUNION3(STL_PA_CLASS_PORT_INFO_CAPABILITY_MASK, 16, + Reserved1: 7, /* start of class dependent bits */ + IsAbsTimeQuerySupported: 1, /* RO - PA supports queries */ + /* w/ absoluteTime in Image ID */ + Reserved2: 8); /* class independent bits*/ + +typedef struct _STL_PA_Group_List { + char groupName[STL_PM_GROUPNAMELEN]; // \0 terminated - actual number indicated by numGroups +} PACK_SUFFIX STL_PA_GROUP_LIST; + +#define PACLIENT_IMAGE_CURRENT 0 // imageNumber of most recent sweep image +#define PACLIENT_IMAGE_TIMED -1 // imageNumber of Image with particular time + +typedef struct _STL_PA_Image_ID_Data { + uint64 imageNumber; + int32 imageOffset; + union { + uint32 absoluteTime; + int32 timeOffset; + } PACK_SUFFIX imageTime; +} PACK_SUFFIX STL_PA_IMAGE_ID_DATA; + +/* Utilization statistical summary */ +typedef struct _STL_PA_PM_Util_Stats { + uint64 totalMBps; /* MB per sec */ + uint64 totalKPps; /* K pkts per sec */ + uint32 avgMBps; + uint32 minMBps; + uint32 maxMBps; + uint32 numBWBuckets; + uint32 BWBuckets[STL_PM_UTIL_BUCKETS]; + uint32 avgKPps; + uint32 minKPps; + uint32 maxKPps; + uint16 pmaNoRespPorts; + uint16 topoIncompPorts; +} PACK_SUFFIX STL_PA_PM_UTIL_STATS; + +/* Error statistical summary */ +typedef struct _STL_PA_PM_CATEGORY_SUMMARY { + uint32 integrityErrors; + uint32 congestion; + uint32 smaCongestion; + uint32 bubble; + uint32 securityErrors; + uint32 routingErrors; + + uint16 utilizationPct10; /* in units of 10% */ + uint16 discardsPct10; /* in units of 10% */ + uint16 reserved[6]; +} PACK_SUFFIX STL_PA_PM_CATEGORY_SUMMARY; + +typedef struct _STL_PM_CATEGORY_THRESHOLD { + uint32 integrityErrors; + uint32 congestion; + uint32 smaCongestion; + uint32 bubble; + uint32 securityErrors; + uint32 routingErrors; +} PACK_SUFFIX STL_PM_CATEGORY_THRESHOLD; + +typedef struct _STL_PM_CATEGORY_BUCKET { + uint32 integrityErrors; + uint32 congestion; + uint32 smaCongestion; + uint32 bubble; + uint32 securityErrors; + uint32 routingErrors; +} PACK_SUFFIX STL_PM_CATEGORY_BUCKET; + +typedef struct _STL_PM_CATEGORY_STATS { + STL_PA_PM_CATEGORY_SUMMARY categoryMaximums; + STL_PM_CATEGORY_BUCKET ports[STL_PM_CATEGORY_BUCKETS]; +} PACK_SUFFIX STL_PM_CATEGORY_STATS; + +typedef struct _STL_PA_Group_Info_Data { + char groupName[STL_PM_GROUPNAMELEN]; // \0 terminated. + STL_PA_IMAGE_ID_DATA imageId; + uint32 numInternalPorts; + uint32 numExternalPorts; + STL_PA_PM_UTIL_STATS internalUtilStats; + STL_PA_PM_UTIL_STATS sendUtilStats; + STL_PA_PM_UTIL_STATS recvUtilStats; + STL_PM_CATEGORY_STATS internalCategoryStats; + STL_PM_CATEGORY_STATS externalCategoryStats; + uint8 maxInternalRate; + uint8 minInternalRate; + uint8 maxExternalRate; + uint8 minExternalRate; + uint32 maxInternalMBps; + uint32 maxExternalMBps; +} PACK_SUFFIX STL_PA_PM_GROUP_INFO_DATA; + +typedef struct _STL_PA_Group_Cfg_Req { + char groupName[STL_PM_GROUPNAMELEN]; // \0 terminated. + STL_PA_IMAGE_ID_DATA imageId; +} PACK_SUFFIX STL_PA_PM_GROUP_CFG_REQ; + +typedef struct _STL_PA_Group_Cfg_Rsp { + STL_PA_IMAGE_ID_DATA imageId; + uint64 nodeGUID; + char nodeDesc[STL_PM_NODEDESCLEN]; // \0 terminated. + uint32 nodeLid; + uint8 portNumber; + uint8 reserved[3]; +} PACK_SUFFIX STL_PA_PM_GROUP_CFG_RSP; + + +// STL_PORT_COUNTERS_DATA.flags +#define STL_PA_PC_FLAG_DELTA 0x00000001 // are these DELTA(1) or running totals +#define STL_PA_PC_FLAG_UNEXPECTED_CLEAR 0x00000002 // was there an unexpected clear +#define STL_PA_PC_FLAG_SHARED_VL 0x00000004 // for vf port counters, vl is shared >1 vf +#define STL_PA_PC_FLAG_USER_COUNTERS 0x00000008 // for PA user controlled running counters + +typedef struct _STL_PORT_COUNTERS_DATA { + uint32 nodeLid; + uint8 portNumber; + uint8 reserved[3]; + uint32 flags; + uint32 reserved1; + uint64 reserved3; + STL_PA_IMAGE_ID_DATA imageId; + uint64 portXmitData; + uint64 portRcvData; + uint64 portXmitPkts; + uint64 portRcvPkts; + uint64 portMulticastXmitPkts; + uint64 portMulticastRcvPkts; + uint64 localLinkIntegrityErrors; + uint64 fmConfigErrors; + uint64 portRcvErrors; + uint64 excessiveBufferOverruns; + uint64 portRcvConstraintErrors; + uint64 portRcvSwitchRelayErrors; + uint64 portXmitDiscards; + uint64 portXmitConstraintErrors; + uint64 portRcvRemotePhysicalErrors; + uint64 swPortCongestion; + uint64 portXmitWait; + uint64 portRcvFECN; + uint64 portRcvBECN; + uint64 portXmitTimeCong; + uint64 portXmitWastedBW; + uint64 portXmitWaitData; + uint64 portRcvBubble; + uint64 portMarkFECN; + uint32 linkErrorRecovery; + uint32 linkDowned; + uint8 uncorrectableErrors; + union { + uint8 AsReg8; + struct { IB_BITFIELD3(uint8, + numLanesDown : 4, + reserved : 1, + linkQualityIndicator : 3) + } PACK_SUFFIX s; + } lq; + uint8 reserved2[6]; +} PACK_SUFFIX STL_PORT_COUNTERS_DATA; + +typedef union { + uint32 AsReg32; + struct stl_counter_select_mask { IB_BITFIELD28(uint32, + PortXmitData : 1, + PortRcvData : 1, + PortXmitPkts : 1, + PortRcvPkts : 1, + PortMulticastXmitPkts : 1, + PortMulticastRcvPkts : 1, + PortXmitWait : 1, + SwPortCongestion : 1, + PortRcvFECN : 1, + PortRcvBECN : 1, + PortXmitTimeCong : 1, + PortXmitWastedBW : 1, + PortXmitWaitData : 1, + PortRcvBubble : 1, + PortMarkFECN : 1, + PortRcvConstraintErrors : 1, + PortRcvSwitchRelayErrors : 1, + PortXmitDiscards : 1, + PortXmitConstraintErrors : 1, + PortRcvRemotePhysicalErrors : 1, + LocalLinkIntegrityErrors : 1, + PortRcvErrors : 1, + ExcessiveBufferOverruns : 1, + FMConfigErrors : 1, + LinkErrorRecovery : 1, + LinkDowned : 1, + UncorrectableErrors : 1, + Reserved : 5) + } PACK_SUFFIX s; +} CounterSelectMask_t; + +typedef struct _STL_CLR_PORT_COUNTERS_DATA { + uint32 NodeLid; + uint8 PortNumber; + uint8 Reserved[3]; + uint64 Reserved2; + CounterSelectMask_t CounterSelectMask; +} PACK_SUFFIX STL_CLR_PORT_COUNTERS_DATA; + +typedef struct _STL_CLR_ALL_PORT_COUNTERS_DATA { + CounterSelectMask_t CounterSelectMask; +} PACK_SUFFIX STL_CLR_ALL_PORT_COUNTERS_DATA; + +typedef struct _STL_INTEGRITY_WEIGHTS { + uint8 LocalLinkIntegrityErrors; + uint8 PortRcvErrors; + uint8 ExcessiveBufferOverruns; + uint8 LinkErrorRecovery; + uint8 LinkDowned; + uint8 UncorrectableErrors; + uint8 FMConfigErrors; + uint8 LinkQualityIndicator; + uint8 LinkWidthDowngrade; + uint8 reserved[7]; +} PACK_SUFFIX STL_INTEGRITY_WEIGHTS_T; + +typedef struct _STL_PM_CATEGORY_THRESHOLDS { + uint32 integrityErrors; + uint32 congestion; + uint32 smaCongestion; + uint32 bubble; + uint32 securityErrors; + uint32 routingErrors; +} PACK_SUFFIX STL_PM_CATEGORY_THRESHOLDS; + +typedef struct _STL_CONGESTION_WEIGHTS { + uint8 PortXmitWait; + uint8 SwPortCongestion; + uint8 PortRcvFECN; + uint8 PortRcvBECN; + uint8 PortXmitTimeCong; + uint8 PortMarkFECN; + uint16 reserved; +} PACK_SUFFIX STL_CONGESTION_WEIGHTS_T; + +/* + * PM configuration flags. + */ +#define STL_PM_NONE 0x0 +#define STL_PM_PROCESS_VL_COUNTERS 0x00000001 // Enable Processing of VL Counters +#define STL_PM_PROCESS_HFI_COUNTERS 0x00000002 // Enable Processing of HFI Counters +#define STL_PM_PROCESS_CLR_DATA_COUNTERS 0x00000004 // Enable Clearing of Data Counters +#define STL_PM_PROCESS_CLR_64BIT_COUNTERS 0x00000008 // Enable Clearing of 64 bit Error Counters +#define STL_PM_PROCESS_CLR_32BIT_COUNTERS 0x00000010 // Enable Clearing of 32 bit Error Counters +#define STL_PM_PROCESS_CLR_8BIT_COUNTERS 0x00000020 // Enable Clearing of 8 bit Error Counters + +typedef struct _STL_PA_PM_Cfg_Data { + uint32 sweepInterval; + uint32 maxClients; + uint32 sizeHistory; + uint32 sizeFreeze; + uint32 lease; + uint32 pmFlags; + STL_CONGESTION_WEIGHTS_T congestionWeights; + STL_PM_CATEGORY_THRESHOLDS categoryThresholds; + STL_INTEGRITY_WEIGHTS_T integrityWeights; + uint64 memoryFootprint; + uint32 maxAttempts; + uint32 respTimeout; + uint32 minRespTimeout; + uint32 maxParallelNodes; + uint32 pmaBatchSize; + uint8 errorClear; + uint8 reserved[3]; +} PACK_SUFFIX STL_PA_PM_CFG_DATA; + +typedef struct _STL_MOVE_FREEZE_DATA { + STL_PA_IMAGE_ID_DATA oldFreezeImage; + STL_PA_IMAGE_ID_DATA newFreezeImage; +} PACK_SUFFIX STL_MOVE_FREEZE_DATA; + +#define STL_PA_SELECT_UTIL_HIGH 0x00020001 // highest first, descending +#define STL_PA_SELECT_UTIL_MC_HIGH 0x00020081 +#define STL_PA_SELECT_UTIL_PKTS_HIGH 0x00020082 +#define STL_PA_SELECT_UTIL_LOW 0x00020101 // lowest first, ascending +#define STL_PA_SELECT_UTIL_MC_LOW 0x00020102 +#define STL_PA_SELECT_CATEGORY_INTEG 0x00030001 // hightest first, descending +#define STL_PA_SELECT_CATEGORY_CONG 0x00030002 +#define STL_PA_SELECT_CATEGORY_SMA_CONG 0x00030003 +#define STL_PA_SELECT_CATEGORY_BUBBLE 0x00030004 +#define STL_PA_SELECT_CATEGORY_SEC 0x00030005 +#define STL_PA_SELECT_CATEGORY_ROUT 0x00030006 + +#define STL_PA_FOCUS_STATUS_OK 0 +#define STL_PA_FOCUS_STATUS_PMA_IGNORE 1 +#define STL_PA_FOCUS_STATUS_PMA_FAILURE 2 +#define STL_PA_FOCUS_STATUS_TOPO_FAILURE 3 + +typedef struct _STL_FOCUS_PORTS_REQ { + char groupName[STL_PM_GROUPNAMELEN]; // \0 terminated + STL_PA_IMAGE_ID_DATA imageId; + uint32 select; + uint32 start; + uint32 range; +} PACK_SUFFIX STL_FOCUS_PORTS_REQ; + +typedef struct _STL_FOCUS_PORTS_RSP { + STL_PA_IMAGE_ID_DATA imageId; + uint32 nodeLid; + uint8 portNumber; + uint8 rate; // IB_STATIC_RATE - 5 bit value + uint8 maxVlMtu; // enum IB_MTU - 4 bit value + IB_BITFIELD2(uint8, localStatus : 4, + neighborStatus : 4) + uint64 value; // list sorting factor + uint64 nodeGUID; + char nodeDesc[STL_PM_NODEDESCLEN]; // \0 terminated. + uint32 neighborLid; + uint8 neighborPortNumber; + uint8 reserved3[3]; + uint64 neighborValue; + uint64 neighborGuid; + char neighborNodeDesc[STL_PM_NODEDESCLEN]; // \0 terminated. +} PACK_SUFFIX STL_FOCUS_PORTS_RSP; + +typedef struct _STL_SMINFO_DATA { + STL_LID_32 lid; + IB_BITFIELD2(uint8, + priority : 4, + state : 4) + uint8 portNumber; + uint16 reserved; + uint64 smPortGuid; + char smNodeDesc[64]; // can be 64 char w/o \0 +} PACK_SUFFIX STL_SMINFO_DATA; + +typedef struct _STL_PA_IMAGE_INFO_DATA { + STL_PA_IMAGE_ID_DATA imageId; + uint64 sweepStart; + uint32 sweepDuration; + uint16 numHFIPorts; + uint16 reserved3; + uint16 reserved; + uint16 numSwitchNodes; + uint32 numSwitchPorts; + uint32 numLinks; + uint32 numSMs; + uint32 numNoRespNodes; + uint32 numNoRespPorts; + uint32 numSkippedNodes; + uint32 numSkippedPorts; + uint32 numUnexpectedClearPorts; + uint32 imageInterval; + STL_SMINFO_DATA SMInfo[2]; +} PACK_SUFFIX STL_PA_IMAGE_INFO_DATA; + +typedef struct _STL_PA_VF_LIST { + char vfName[STL_PM_VFNAMELEN]; // \0 terminated +} PACK_SUFFIX STL_PA_VF_LIST; + +typedef struct _STL_PA_VF_INFO_DATA { + char vfName[STL_PM_VFNAMELEN]; // \0 terminated + uint64 reserved; + STL_PA_IMAGE_ID_DATA imageId; + uint32 numPorts; + STL_PA_PM_UTIL_STATS internalUtilStats; + STL_PM_CATEGORY_STATS internalCategoryStats; + // these are added at the end to allow for forward and backward + // compatibility. + uint8 maxInternalRate; + uint8 minInternalRate; + uint32 maxInternalMBps; +} PACK_SUFFIX STL_PA_VF_INFO_DATA; + +typedef struct _STL_PA_VF_Cfg_Req { + char vfName[STL_PM_VFNAMELEN]; // \0 terminated + uint64 reserved; + STL_PA_IMAGE_ID_DATA imageId; +} PACK_SUFFIX STL_PA_VF_CFG_REQ; + +typedef struct _STL_PA_VF_Cfg_Rsp { + STL_PA_IMAGE_ID_DATA imageId; + uint64 nodeGUID; + char nodeDesc[STL_PM_NODEDESCLEN]; // \0 terminated. + uint32 nodeLid; + uint8 portNumber; + uint8 reserved[3]; +} PACK_SUFFIX STL_PA_VF_CFG_RSP; + +typedef struct _STL_PA_VF_PORT_COUNTERS_DATA { + uint32 nodeLid; + uint8 portNumber; + uint8 reserved[3]; + uint32 flags; + uint32 reserved1; + uint64 reserved3; + char vfName[STL_PM_VFNAMELEN]; // \0 terminated + uint64 reserved2; + STL_PA_IMAGE_ID_DATA imageId; + uint64 portVFXmitData; + uint64 portVFRcvData; + uint64 portVFXmitPkts; + uint64 portVFRcvPkts; + uint64 portVFXmitDiscards; + uint64 swPortVFCongestion; + uint64 portVFXmitWait; + uint64 portVFRcvFECN; + uint64 portVFRcvBECN; + uint64 portVFXmitTimeCong; + uint64 portVFXmitWastedBW; + uint64 portVFXmitWaitData; + uint64 portVFRcvBubble; + uint64 portVFMarkFECN; +} PACK_SUFFIX STL_PA_VF_PORT_COUNTERS_DATA; + +typedef union { + uint32 AsReg32; + struct { IB_BITFIELD15(uint32, + PortVLXmitData : 1, + PortVLRcvData : 1, + PortVLXmitPkts : 1, + PortVLRcvPkts : 1, + PortVLXmitDiscards : 1, + SwPortVLCongestion : 1, + PortVLXmitWait : 1, + PortVLRcvFECN : 1, + PortVLRcvBECN : 1, + PortVLXmitTimeCong : 1, + PortVLXmitWastedBW : 1, + PortVLXmitWaitData : 1, + PortVLRcvBubble : 1, + PortVLMarkFECN : 1, + reserved : 18) + } PACK_SUFFIX s; +} STLVlCounterSelectMask; + +typedef struct _STL_PA_CLEAR_VF_PORT_COUNTERS_DATA { + uint32 nodeLid; + uint8 portNumber; + uint8 reserved[3]; + uint64 reserved4; + char vfName[STL_PM_VFNAMELEN]; // \0 terminated + uint64 reserved3; + STLVlCounterSelectMask vfCounterSelectMask; + uint32 reserved2; +} PACK_SUFFIX STL_PA_CLEAR_VF_PORT_COUNTERS_DATA; + +typedef struct _STL_PA_VF_FOCUS_PORTS_REQ { + char vfName[STL_PM_VFNAMELEN]; // \0 terminated + uint64 reserved; + STL_PA_IMAGE_ID_DATA imageId; + uint32 select; + uint32 start; + uint32 range; +} PACK_SUFFIX STL_PA_VF_FOCUS_PORTS_REQ; + +typedef struct _STL_PA_VF_FOCUS_PORTS_RSP { + STL_PA_IMAGE_ID_DATA imageId; + uint32 nodeLid; + uint8 portNumber; + uint8 rate; // IB_STATIC_RATE - 5 bit value + uint8 maxVlMtu; // enum IB_MTU - 4 bit value + IB_BITFIELD2(uint8, localStatus : 4, + neighborStatus : 4) + uint64 value; // list sorting factor + uint64 nodeGUID; + char nodeDesc[STL_PM_NODEDESCLEN]; // \0 terminated. + uint32 neighborLid; + uint8 neighborPortNumber; + uint8 reserved3[3]; + uint64 neighborValue; + uint64 neighborGuid; + char neighborNodeDesc[STL_PM_NODEDESCLEN]; // \0 terminated. +} PACK_SUFFIX STL_PA_VF_FOCUS_PORTS_RSP; + +/* End of packed data structures */ +#include "iba/public/ipackoff.h" + +/* Performance Analysis methods */ +#define STL_PA_CMD_GET (0x01) +#define STL_PA_CMD_SET (0x02) +#define STL_PA_CMD_GET_RESP (0x81) +#define STL_PA_CMD_GETTABLE (0x12) +#define STL_PA_CMD_GETTABLE_RESP (0x92) + +/* Performance Analysis attribute IDs */ +#define STL_PA_ATTRID_GET_CLASSPORTINFO 0x01 +#define STL_PA_ATTRID_GET_GRP_LIST 0xA0 +#define STL_PA_ATTRID_GET_GRP_INFO 0xA1 +#define STL_PA_ATTRID_GET_GRP_CFG 0xA2 +#define STL_PA_ATTRID_GET_PORT_CTRS 0xA3 +#define STL_PA_ATTRID_CLR_PORT_CTRS 0xA4 +#define STL_PA_ATTRID_CLR_ALL_PORT_CTRS 0xA5 +#define STL_PA_ATTRID_GET_PM_CONFIG 0xA6 +#define STL_PA_ATTRID_FREEZE_IMAGE 0xA7 +#define STL_PA_ATTRID_RELEASE_IMAGE 0xA8 +#define STL_PA_ATTRID_RENEW_IMAGE 0xA9 +#define STL_PA_ATTRID_GET_FOCUS_PORTS 0xAA +#define STL_PA_ATTRID_GET_IMAGE_INFO 0xAB +#define STL_PA_ATTRID_MOVE_FREEZE_FRAME 0xAC +#define STL_PA_ATTRID_GET_VF_LIST 0xAD +#define STL_PA_ATTRID_GET_VF_INFO 0xAE +#define STL_PA_ATTRID_GET_VF_CONFIG 0xAF +#define STL_PA_ATTRID_GET_VF_PORT_CTRS 0xB0 +#define STL_PA_ATTRID_CLR_VF_PORT_CTRS 0xB1 +#define STL_PA_ATTRID_GET_VF_FOCUS_PORTS 0xB2 + +/* Performance Analysis MAD status values */ +#define STL_MAD_STATUS_STL_PA_UNAVAILABLE 0x0A00 // Engine unavailable +#define STL_MAD_STATUS_STL_PA_NO_GROUP 0x0B00 // No such group +#define STL_MAD_STATUS_STL_PA_NO_PORT 0x0C00 // Port not found +#define STL_MAD_STATUS_STL_PA_NO_VF 0x0D00 // VF not found +#define STL_MAD_STATUS_STL_PA_INVALID_PARAMETER 0x0E00 // Invalid parameter +#define STL_MAD_STATUS_STL_PA_NO_IMAGE 0x0F00 // Image not found + +/* PM Service Record values */ +#define STL_PM_SERVICE_NAME "Primary Intel OmniPath Performance Manager" +#define STL_PM_SERVICE_NAME_SEC "Secondary Intel OmniPath Performance Manager" +#define STL_PM_SERVICE_ID (0x1100d03c34845555ull) +#define STL_PM_SERVICE_ID_SEC (0x1100d03c34845555ull) +#define STL_PM_VERSION 0x01 +#define STL_PM_MASTER 0x01 /* master state */ +#define STL_PM_STANDBY 0x02 /* standby state */ + +#define STL_PA_DATA_OFFSET 32 + +#define STL_PA_CLASS_VERSION 0x80 + +static __inline void +StlPaClassPortInfoCapMask(char buf[80], uint16 cmask) +{ + if (!cmask) { + snprintf(buf, 80, "-"); + } else { + snprintf(buf, 80, "%s%s%s%s", + (cmask & STL_CLASS_PORT_CAPMASK_TRAP) ? "Trap " : "", + (cmask & STL_CLASS_PORT_CAPMASK_NOTICE) ? "Notice " : "", + (cmask & STL_CLASS_PORT_CAPMASK_CM2) ? "CapMask2 " : "", + /* Class Specific */ + (cmask & STL_PA_CPI_CAPMASK_ABSTIMEQUERY) ? "AbsTime " : ""); + } +} + +static __inline void +StlPaClassPortInfoCapMask2(char buf[80], uint32 cmask) +{ + if (!cmask) { + snprintf(buf, 80, "-"); + } else { + buf[0] = '\0'; + } +} + +static __inline +void StlFormatPmFlags(char buf[80], uint32 pmFlags) +{ + snprintf(buf, 80, "%s=%s %s=%s %s=%s %s=%s", + "ProcessHFICntrs", pmFlags & STL_PM_PROCESS_HFI_COUNTERS ? "On" : "Off", + "ProcessVLCntrs", pmFlags & STL_PM_PROCESS_VL_COUNTERS ? "On" : "Off", + "ClrDataCntrs", pmFlags & STL_PM_PROCESS_CLR_DATA_COUNTERS ? "On" : "Off", + "Clr64bitErrCntrs", pmFlags & STL_PM_PROCESS_CLR_64BIT_COUNTERS ? "On" : "Off"); +} + +static __inline +void StlFormatPmFlags2(char buf[80], uint32 pmFlags) +{ + snprintf(buf, 80, "%s=%s %s=%s", + "Clr32bitErrCntrs", pmFlags & STL_PM_PROCESS_CLR_32BIT_COUNTERS ? "On" : "Off", + "Clr8bitErrCntrs", pmFlags & STL_PM_PROCESS_CLR_8BIT_COUNTERS ? "On" : "Off"); +} + +static __inline +const char* StlFocusStatusToText(uint8 status) +{ + switch (status) { + case STL_PA_FOCUS_STATUS_OK: return "OK"; + case STL_PA_FOCUS_STATUS_PMA_IGNORE: return "PMA Ignore"; + case STL_PA_FOCUS_STATUS_PMA_FAILURE: return "PMA Failure"; + case STL_PA_FOCUS_STATUS_TOPO_FAILURE: return "Topo Failure"; + default: return "Unknown"; + } +} + +/* LinkQualityIndicator values */ +#define STL_LINKQUALITY_EXCELLENT 5 /* working as intended */ +#define STL_LINKQUALITY_VERY_GOOD 4 /* slightly below preferred, */ + /* no action needed */ +#define STL_LINKQUALITY_GOOD 3 /* low end of acceptable, */ + /* recommend corrective action on */ + /* next maintenance window */ +#define STL_LINKQUALITY_POOR 2 /* below acceptable, */ + /* recommend timely corrective action */ +#define STL_LINKQUALITY_BAD 1 /* far below acceptable, */ + /* immediate corrective action */ +#define STL_LINKQUALITY_NONE 0 /* link down */ + +#ifdef __cplusplus +} +#endif + +#endif /* _STL_PA_TYPES_H_ */ diff --git a/IbAccess/Common/Inc/stl_pm.h b/IbAccess/Common/Inc/stl_pm.h index 83f2af3f..73198221 100644 --- a/IbAccess/Common/Inc/stl_pm.h +++ b/IbAccess/Common/Inc/stl_pm.h @@ -32,8 +32,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef __IBA_STL_PM_H__ #define __IBA_STL_PM_H__ -#include "iba/ib_pm.h" +#include "iba/ib_generalServices.h" #include "iba/stl_types.h" +#include "iba/stl_pa_types.h" #if defined (__cplusplus) extern "C" { @@ -77,6 +78,9 @@ static __inline uint32 idx_to_vl(uint32 idx) { return idx; } +/* if AllPortSelect capability, use this as PortNum to operate on all ports */ +#define PM_ALL_PORT_SELECT 0xff + #define MAX_PM_PORTS 49 /* max in STL Gen1 (ports 0-48 on PRR switch) */ @@ -144,6 +148,13 @@ StlPmClassPortInfoCapMask2(char buf[80], uint32 cmask) /* MAD structure definitions */ +typedef struct _STL_PERF_MAD { + MAD_COMMON common; /* Generic MAD Header */ + + uint8 PerfData[STL_GS_DATASIZE]; /* Performance Management Data */ +} PACK_SUFFIX STL_PERF_MAD, *PSTL_PERF_MAD; + + /* STL Port Counters - small request, large response */ typedef struct _STL_Port_Status_Req { @@ -210,53 +221,6 @@ typedef struct _STL_Port_Status_Rsp { } VLs[1]; /* n defined by number of bits in VLSelectmask */ } PACK_SUFFIX STLPortStatusRsp, STL_PORT_STATUS_RSP; -/* LinkQualityIndicator values */ -#define STL_LINKQUALITY_EXCELLENT 5 /* working as intended */ -#define STL_LINKQUALITY_VERY_GOOD 4 /* slightly below preferred, */ - /* no action needed */ -#define STL_LINKQUALITY_GOOD 3 /* low end of acceptable, */ - /* recommend corrective action on */ - /* next maintenance window */ -#define STL_LINKQUALITY_POOR 2 /* below acceptable, */ - /* recommend timely corrective action */ -#define STL_LINKQUALITY_BAD 1 /* far below acceptable, */ - /* immediate corrective action */ -#define STL_LINKQUALITY_NONE 0 /* link down */ - -typedef union { - uint32 AsReg32; - struct stl_counter_select_mask { IB_BITFIELD28(uint32, - PortXmitData : 1, - PortRcvData : 1, - PortXmitPkts : 1, - PortRcvPkts : 1, - PortMulticastXmitPkts : 1, - PortMulticastRcvPkts : 1, - PortXmitWait : 1, - SwPortCongestion : 1, - PortRcvFECN : 1, - PortRcvBECN : 1, - PortXmitTimeCong : 1, - PortXmitWastedBW : 1, - PortXmitWaitData : 1, - PortRcvBubble : 1, - PortMarkFECN : 1, - PortRcvConstraintErrors : 1, - PortRcvSwitchRelayErrors : 1, - PortXmitDiscards : 1, - PortXmitConstraintErrors : 1, - PortRcvRemotePhysicalErrors : 1, - LocalLinkIntegrityErrors : 1, - PortRcvErrors : 1, - ExcessiveBufferOverruns : 1, - FMConfigErrors : 1, - LinkErrorRecovery : 1, - LinkDowned : 1, - UncorrectableErrors : 1, - Reserved : 5) - } PACK_SUFFIX s; -} CounterSelectMask_t; - typedef struct _STL_Clear_Port_Status { uint64 PortSelectMask[4]; CounterSelectMask_t CounterSelectMask; @@ -610,8 +574,7 @@ BSWAP_STL_PORT_STATUS_RSP(STL_PORT_STATUS_RSP *Dest) #endif } -static __inline -void +static __inline void BSWAP_STL_CLEAR_PORT_STATUS_REQ(STL_CLEAR_PORT_STATUS *Dest) { #if CPU_LE @@ -622,8 +585,7 @@ BSWAP_STL_CLEAR_PORT_STATUS_REQ(STL_CLEAR_PORT_STATUS *Dest) #endif } -static __inline -void +static __inline void BSWAP_STL_DATA_PORT_COUNTERS_REQ(STL_DATA_PORT_COUNTERS_REQ *Dest) { #if CPU_LE @@ -635,8 +597,7 @@ BSWAP_STL_DATA_PORT_COUNTERS_REQ(STL_DATA_PORT_COUNTERS_REQ *Dest) #endif } -static __inline -void +static __inline void BSWAP_STL_DATA_PORT_COUNTERS_RSP(STL_DATA_PORT_COUNTERS_RSP *Dest) { #if CPU_LE @@ -698,8 +659,7 @@ BSWAP_STL_DATA_PORT_COUNTERS_RSP(STL_DATA_PORT_COUNTERS_RSP *Dest) #endif } -static __inline -void +static __inline void BSWAP_STL_ERROR_PORT_COUNTERS_REQ(STL_ERROR_PORT_COUNTERS_REQ *Dest) { #if CPU_LE @@ -710,8 +670,7 @@ BSWAP_STL_ERROR_PORT_COUNTERS_REQ(STL_ERROR_PORT_COUNTERS_REQ *Dest) #endif } -static __inline -void +static __inline void BSWAP_STL_ERROR_PORT_COUNTERS_RSP(STL_ERROR_PORT_COUNTERS_RSP *Dest) { #if CPU_LE @@ -755,8 +714,7 @@ BSWAP_STL_ERROR_PORT_COUNTERS_RSP(STL_ERROR_PORT_COUNTERS_RSP *Dest) #endif } -static __inline -void +static __inline void BSWAP_STL_ERROR_INFO_REQ(STL_ERROR_INFO_REQ *Dest) { #if CPU_LE @@ -769,8 +727,7 @@ BSWAP_STL_ERROR_INFO_REQ(STL_ERROR_INFO_REQ *Dest) #endif } -static __inline -void +static __inline void BSWAP_STL_ERROR_INFO_RSP(STL_ERROR_INFO_RSP *Dest) { #if CPU_LE @@ -796,6 +753,48 @@ BSWAP_STL_ERROR_INFO_RSP(STL_ERROR_INFO_RSP *Dest) #endif } +/** + * Copy data in a STL_PORT_COUNTERS_DATA variable into a STL_PortStatusData_t variable + * + * @param portCounters - pointer to STL_PORT_COUNTERS_DATA variable from which to copy + * @param portStatusData - pointer to STL_PortStatusData_t variable to copy to + * + */ +static __inline void +StlPortCountersToPortStatus(STL_PORT_COUNTERS_DATA *portCounters, STL_PORT_STATUS_RSP *portStatusData) +{ + portStatusData->LinkErrorRecovery = portCounters->linkErrorRecovery; + portStatusData->LinkDowned = portCounters->linkDowned; + portStatusData->PortRcvErrors = portCounters->portRcvErrors; + portStatusData->PortRcvRemotePhysicalErrors = portCounters->portRcvRemotePhysicalErrors; + portStatusData->PortRcvSwitchRelayErrors = portCounters->portRcvSwitchRelayErrors; + portStatusData->PortXmitDiscards = portCounters->portXmitDiscards; + portStatusData->PortXmitConstraintErrors = portCounters->portXmitConstraintErrors; + portStatusData->PortRcvConstraintErrors = portCounters->portRcvConstraintErrors; + portStatusData->LocalLinkIntegrityErrors = portCounters->localLinkIntegrityErrors; + portStatusData->ExcessiveBufferOverruns = portCounters->excessiveBufferOverruns; + portStatusData->PortXmitData = portCounters->portXmitData; + portStatusData->PortRcvData = portCounters->portRcvData; + portStatusData->PortXmitPkts = portCounters->portXmitPkts; + portStatusData->PortRcvPkts = portCounters->portRcvPkts; + portStatusData->PortMulticastXmitPkts = portCounters->portMulticastXmitPkts; + portStatusData->PortMulticastRcvPkts = portCounters->portMulticastRcvPkts; + portStatusData->PortXmitWait = portCounters->portXmitWait; + portStatusData->SwPortCongestion = portCounters->swPortCongestion; + portStatusData->PortRcvFECN = portCounters->portRcvFECN; + portStatusData->PortRcvBECN = portCounters->portRcvBECN; + portStatusData->PortXmitTimeCong = portCounters->portXmitTimeCong; + portStatusData->PortXmitWastedBW = portCounters->portXmitWastedBW; + portStatusData->PortXmitWaitData = portCounters->portXmitWaitData; + portStatusData->PortRcvBubble = portCounters->portRcvBubble; + portStatusData->PortMarkFECN = portCounters->portMarkFECN; + portStatusData->FMConfigErrors = portCounters->fmConfigErrors; + portStatusData->UncorrectableErrors = portCounters->uncorrectableErrors; + portStatusData->lq.AsReg8 = portCounters->lq.AsReg8; +} + +#include "iba/public/ipackoff.h" + #if defined (__cplusplus) }; #endif diff --git a/IbAccess/Common/Inc/stl_sa_priv.h b/IbAccess/Common/Inc/stl_sa_priv.h new file mode 100644 index 00000000..d544fc95 --- /dev/null +++ b/IbAccess/Common/Inc/stl_sa_priv.h @@ -0,0 +1,750 @@ +/* BEGIN_ICS_COPYRIGHT7 **************************************** + +Copyright (c) 2015-2017, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +** END_ICS_COPYRIGHT7 ****************************************/ + +/* [ICS VERSION STRING: unknown] */ + +#ifndef __STL_SA_PRIV_H__ +#define __STL_SA_PRIV_H__ + +#include "iba/stl_mad_priv.h" +#include "iba/stl_sa_types.h" +#include "iba/ib_sa_records_priv.h" +#include "iba/stl_sm_priv.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +// Replaces old Vieo macro that converts a single GID argument into two arguments +// that can be used in a print statement. +#define STLGIDPRINTARGS(GID) ntoh64((GID).Type.Global.SubnetPrefix), \ + ntoh64((GID).Type.Global.InterfaceID) + +#define STLGIDPRINTARGS2(GID) ntoh64(alignArray64(&GID[0])), ntoh64(alignArray64(&GID[8])) + +static __inline__ uint64_t +_alignArray64(uint8_t * array) { uint64_t rv; memcpy(&rv, array, sizeof(rv));return rv;} + +#include "iba/public/ipackon.h" + +/* + * SA Header + */ +typedef struct { + uint8_t rmppVersion; + uint8_t rmppType; + union { + struct { + #if CPU_BE + uint8_t rmppRespTime : 5; + uint8_t rmppFlags : 3; + #else + uint8_t rmppFlags : 3; + uint8_t rmppRespTime : 5; + #endif + } tf; + uint8_t timeFlag; + } u; + uint8_t rmppStatus; + uint32_t segNum; + uint32_t length; + uint64_t smKey; + uint16_t offset; + uint16_t rservd; + uint64_t mask; +} PACK_SUFFIX STL_SA_MAD_HEADER; + +#define STL_SA_DATA_LEN (STL_MAD_BLOCK_SIZE-sizeof(STL_SA_MAD_HEADER)-sizeof(MAD_COMMON)) + +typedef struct { + STL_SA_MAD_HEADER header; + uint8_t data[STL_SA_DATA_LEN]; +} PACK_SUFFIX STL_SA_MAD; + +static __inline void +BSWAPCOPY_STL_SA_MAD_HEADER(STL_SA_MAD_HEADER *src, STL_SA_MAD_HEADER *dst) +{ + dst->rmppVersion = src->rmppVersion; + dst->rmppType = src->rmppType; + dst->rmppStatus = src->rmppStatus; + dst->u.timeFlag = src->u.timeFlag; + + dst->segNum = ntoh32(src->segNum); + dst->length = ntoh32(src->length); + dst->smKey = ntoh64(src->smKey); + dst->offset = ntoh16(src->offset); + dst->rservd = ntoh16(src->rservd); + dst->mask = ntoh64(src->mask); +} + +static __inline void +BSWAPCOPY_STL_SA_MAD(STL_SA_MAD *src, STL_SA_MAD *dst, size_t len) +{ + BSWAPCOPY_STL_SA_MAD_HEADER(&src->header,&dst->header); + memcpy(&dst->data, &src->data, len); +} + +static __inline void +BSWAP_STL_NODE_RECORD(STL_NODE_RECORD *Dest) +{ + Dest->RID.LID = ntoh32(Dest->RID.LID); + BSWAP_STL_NODE_INFO(&Dest->NodeInfo); +} + +static __inline void +BSWAPCOPY_STL_NODE_RECORD(STL_NODE_RECORD *Src, STL_NODE_RECORD *Dest) +{ + Dest->RID.LID = ntoh32(Src->RID.LID); + BSWAPCOPY_STL_NODE_INFO(&Src->NodeInfo, &Dest->NodeInfo); + memcpy(&(Dest->NodeDesc), &(Src->NodeDesc), sizeof(STL_NODE_DESCRIPTION)); +} + +static __inline void +BSWAPCOPY_IB_NODE_RECORD(IB_NODE_RECORD *Src, IB_NODE_RECORD *Dest) +{ + Dest->RID.AsReg32 = ntoh32(Src->RID.AsReg32); + memcpy(&Dest->NodeInfoData,&Src->NodeInfoData,sizeof(NODE_INFO)); + BSWAP_NODE_INFO(&Dest->NodeInfoData); + memcpy(&(Dest->NodeDescData), &(Src->NodeDescData), sizeof(NODE_DESCRIPTION)); +} + +static __inline void +BSWAP_STL_PORTINFO_RECORD(STL_PORTINFO_RECORD *Dest) +{ +#if CPU_LE + int i; + + Dest->RID.EndPortLID = ntoh32(Dest->RID.EndPortLID); + BSWAP_STL_PORT_INFO(&Dest->PortInfo); + + for(i = 0; i < STL_NUM_LINKDOWN_REASONS; i++){ + Dest->LinkDownReasons[i].Timestamp = ntoh64(Dest->LinkDownReasons[i].Timestamp); + } +#endif +} + +static __inline void +BSWAP_STL_PARTITION_TABLE_RECORD(STL_P_KEY_TABLE_RECORD *Dest) +{ + Dest->RID.LID = ntoh32(Dest->RID.LID); + Dest->RID.Blocknum = ntoh16(Dest->RID.Blocknum); + BSWAP_STL_PARTITION_TABLE(&Dest->PKeyTblData); +} + +static __inline void +BSWAPCOPY_STL_PARTITION_TABLE_RECORD(STL_P_KEY_TABLE_RECORD *Src, STL_P_KEY_TABLE_RECORD *Dest) +{ + memcpy(Dest, Src, sizeof(STL_P_KEY_TABLE_RECORD)); + BSWAP_STL_PARTITION_TABLE_RECORD(Dest); +} + +static __inline void +BSWAP_STL_SC_MAPPING_TABLE_RECORD(STL_SC_MAPPING_TABLE_RECORD *Dest) +{ + Dest->RID.LID = ntoh32(Dest->RID.LID); +} + +static __inline void +BSWAPCOPY_STL_SC_MAPPING_TABLE_RECORD(STL_SC_MAPPING_TABLE_RECORD *Src, STL_SC_MAPPING_TABLE_RECORD *Dest) +{ + memcpy(Dest, Src, sizeof(STL_SC_MAPPING_TABLE_RECORD)); + BSWAP_STL_SC_MAPPING_TABLE_RECORD(Dest); +} + +static __inline void +BSWAP_STL_SL2SC_MAPPING_TABLE_RECORD(STL_SL2SC_MAPPING_TABLE_RECORD *Dest) +{ + Dest->RID.LID=ntoh32(Dest->RID.LID); +} + +static __inline void +BSWAPCOPY_STL_SL2SC_MAPPING_TABLE_RECORD(STL_SL2SC_MAPPING_TABLE_RECORD *Src, STL_SL2SC_MAPPING_TABLE_RECORD *Dest) +{ + memcpy(Dest, Src, sizeof(STL_SL2SC_MAPPING_TABLE_RECORD)); + BSWAP_STL_SL2SC_MAPPING_TABLE_RECORD(Dest); +} + +static __inline void +BSWAP_STL_SC2SL_MAPPING_TABLE_RECORD(STL_SC2SL_MAPPING_TABLE_RECORD *Dest) +{ + Dest->RID.LID=ntoh32(Dest->RID.LID); +} + +static __inline void +BSWAPCOPY_STL_SC2SL_MAPPING_TABLE_RECORD(STL_SC2SL_MAPPING_TABLE_RECORD *Src, STL_SC2SL_MAPPING_TABLE_RECORD *Dest) +{ + memcpy(Dest, Src, sizeof(STL_SC2SL_MAPPING_TABLE_RECORD)); + BSWAP_STL_SC2SL_MAPPING_TABLE_RECORD(Dest); +} + +static __inline void +BSWAP_STL_SC2VL_R_MAPPING_TABLE_RECORD(STL_SC2VL_R_MAPPING_TABLE_RECORD *Dest) +{ + Dest->RID.LID=ntoh32(Dest->RID.LID); +} + +static __inline void +BSWAPCOPY_STL_SC2VL_R_MAPPING_TABLE_RECORD(STL_SC2VL_R_MAPPING_TABLE_RECORD *Src, STL_SC2VL_R_MAPPING_TABLE_RECORD *Dest) +{ + memcpy(Dest, Src, sizeof(STL_SC2VL_R_MAPPING_TABLE_RECORD)); + BSWAP_STL_SC2VL_R_MAPPING_TABLE_RECORD(Dest); +} + +static __inline void +BSWAPCOPY_STL_SWITCHINFO_RECORD(STL_SWITCHINFO_RECORD *Src, STL_SWITCHINFO_RECORD *Dest) +{ + Dest->RID.LID = ntoh32(Src->RID.LID); + BSWAPCOPY_STL_SWITCH_INFO(&Src->SwitchInfoData, &Dest->SwitchInfoData); +} + +static __inline void +BSWAP_STL_SWITCHINFO_RECORD(STL_SWITCHINFO_RECORD *Dest) +{ + Dest->RID.LID = ntoh32(Dest->RID.LID); + BSWAP_STL_SWITCH_INFO(&Dest->SwitchInfoData); +} + +static __inline void +BSWAP_STL_LINEAR_FORWARDING_TABLE_RECORD(STL_LINEAR_FORWARDING_TABLE_RECORD *Dest) +{ + Dest->RID.LID = ntoh32(Dest->RID.LID); + (*(uint32*)((char *)Dest + sizeof(uint32))) = ntoh32(*(uint32*)((char *)Dest + sizeof(uint32))); + BSWAP_STL_LINEAR_FORWARDING_TABLE((STL_LINEAR_FORWARDING_TABLE *)Dest->LinearFdbData); +} + +static __inline void +BSWAPCOPY_STL_LINEAR_FORWARDING_TABLE_RECORD(STL_LINEAR_FORWARDING_TABLE_RECORD *Src, STL_LINEAR_FORWARDING_TABLE_RECORD *Dest) +{ + memcpy(Dest, Src, sizeof(STL_LINEAR_FORWARDING_TABLE_RECORD)); + BSWAP_STL_LINEAR_FORWARDING_TABLE_RECORD(Dest); +} + +static __inline void +BSWAP_STL_MCFTB_RECORD(STL_MULTICAST_FORWARDING_TABLE_RECORD *Dest) +{ + int i; + Dest->RID.LID = ntoh32(Dest->RID.LID); + Dest->RID.u1.AsReg32 = ntoh32(Dest->RID.u1.AsReg32); + for (i = 0; i < STL_NUM_MFT_ELEMENTS_BLOCK; ++i) Dest->MftTable.MftBlock[i] = ntoh64(Dest->MftTable.MftBlock[i]); +} + +static __inline void +BSWAPCOPY_STL_MCFTB_RECORD(STL_MULTICAST_FORWARDING_TABLE_RECORD *Src, STL_MULTICAST_FORWARDING_TABLE_RECORD *Dest) +{ + memcpy(Dest, Src, sizeof(STL_MULTICAST_FORWARDING_TABLE_RECORD)); + BSWAP_STL_MCFTB_RECORD(Dest); +} + +static __inline void +BSWAP_STL_PORT_GROUP_TABLE_RECORD(STL_PORT_GROUP_TABLE_RECORD *Dest) +{ + int i; + Dest->RID.LID = ntoh32(Dest->RID.LID); + for (i = 0; i < STL_PGTB_NUM_ENTRIES_PER_BLOCK; ++i) Dest->GroupBlock[i] = ntoh64(Dest->GroupBlock[i]); +} + +static __inline void +BSWAPCOPY_STL_PORT_GROUP_TABLE_RECORD(STL_PORT_GROUP_TABLE_RECORD *Src, STL_PORT_GROUP_TABLE_RECORD *Dest) +{ + memcpy(Dest, Src, sizeof(STL_PORT_GROUP_TABLE_RECORD)); + BSWAP_STL_PORT_GROUP_TABLE_RECORD(Dest); +} + +static __inline void +BSWAP_STL_PORT_GROUP_FORWARDING_TABLE_RECORD(STL_PORT_GROUP_FORWARDING_TABLE_RECORD *Dest) +{ + Dest->RID.LID = ntoh32(Dest->RID.LID); + Dest->RID.u1.AsReg32 = ntoh32(Dest->RID.u1.AsReg32); +} + +static __inline void +BSWAPCOPY_STL_PORT_GROUP_FORWARDING_TABLE_RECORD(STL_PORT_GROUP_FORWARDING_TABLE_RECORD *Src, STL_PORT_GROUP_FORWARDING_TABLE_RECORD *Dest) +{ + memcpy(Dest, Src, sizeof(STL_PORT_GROUP_FORWARDING_TABLE_RECORD)); + BSWAP_STL_PORT_GROUP_FORWARDING_TABLE_RECORD(Dest); +} + +static __inline void +BSWAP_STL_VLARBTABLE_RECORD(STL_VLARBTABLE_RECORD *Dest) +{ + Dest->RID.LID = ntoh32(Dest->RID.LID); + BSWAP_STL_VLARB_TABLE(&Dest->VLArbTable, Dest->RID.BlockNum); +} + +static __inline void +BSWAPCOPY_STL_VLARBTABLE_RECORD(STL_VLARBTABLE_RECORD *Src, STL_VLARBTABLE_RECORD *Dest) +{ + memcpy(Dest, Src, sizeof(STL_VLARBTABLE_RECORD)); + BSWAP_STL_VLARBTABLE_RECORD(Dest); +} + +static __inline void +BSWAP_STL_MCMEMBER_RECORD(STL_MCMEMBER_RECORD *Dest) +{ + uint64_t temp; + + temp = ntoh64(Dest->RID.MGID.AsReg64s.H); + Dest->RID.MGID.AsReg64s.H = ntoh64(Dest->RID.MGID.AsReg64s.L); + Dest->RID.MGID.AsReg64s.L = temp; + + temp = ntoh64(Dest->RID.PortGID.AsReg64s.H); + Dest->RID.PortGID.AsReg64s.H = ntoh64(Dest->RID.PortGID.AsReg64s.L); + Dest->RID.PortGID.AsReg64s.L = temp; + + Dest->Q_Key = ntoh32(Dest->Q_Key); + Dest->P_Key = ntoh16(Dest->P_Key); + *(uint32*)((uint8*)Dest + 44) = ntoh32( *(uint32*)( (uint8*)Dest + 44) ); + Dest->MLID = ntoh32(Dest->MLID); +} + +static __inline void +BSWAPCOPY_STL_MCMEMBER_RECORD(STL_MCMEMBER_RECORD *Src, STL_MCMEMBER_RECORD *Dest) +{ + memcpy(Dest, Src, sizeof(STL_MCMEMBER_RECORD)); + BSWAP_STL_MCMEMBER_RECORD(Dest); +} + +static __inline void +CONVERT_IB2STL_MCMEMBER_RECORD(IB_MCMEMBER_RECORD *Src, STL_MCMEMBER_RECORD *Dest) +{ + Dest->RID.MGID = Src->RID.MGID; + Dest->RID.PortGID = Src->RID.PortGID; + Dest->Q_Key = Src->Q_Key; + Dest->MLID = Src->MLID; + Dest->MtuSelector = Src->MtuSelector; + Dest->Mtu = Src->Mtu; + Dest->TClass = Src->TClass; + Dest->P_Key = Src->P_Key; + Dest->RateSelector = Src->RateSelector; + Dest->Rate = Src->Rate; + Dest->PktLifeTimeSelector = Src->PktLifeTimeSelector; + Dest->PktLifeTime = Src->PktLifeTime; + Dest->SL = Src->u1.s.SL; + Dest->HopLimit = Src->u1.s.HopLimit; + Dest->Scope = Src->Scope; + Dest->JoinFullMember = Src->JoinFullMember; + Dest->JoinSendOnlyMember = Src->JoinSendOnlyMember; + Dest->JoinNonMember = Src->JoinNonMember; + Dest->ProxyJoin = Src->ProxyJoin; +} + +static __inline void +CONVERT_STL2IB_MCMEMBER_RECORD(STL_MCMEMBER_RECORD *Src, IB_MCMEMBER_RECORD *Dest) +{ + Dest->RID.MGID = Src->RID.MGID; + Dest->RID.PortGID = Src->RID.PortGID; + Dest->Q_Key = Src->Q_Key; + Dest->MLID = Src->MLID; + Dest->MtuSelector = Src->MtuSelector; + Dest->Mtu = Src->Mtu; + Dest->TClass = Src->TClass; + Dest->P_Key = Src->P_Key; + Dest->RateSelector = Src->RateSelector; + Dest->Rate = Src->Rate; + Dest->PktLifeTimeSelector = Src->PktLifeTimeSelector; + Dest->PktLifeTime = Src->PktLifeTime; + Dest->u1.s.SL = Src->SL; + Dest->u1.s.FlowLabel = 0; + Dest->u1.s.HopLimit = Src->HopLimit; + Dest->Scope = Src->Scope; + Dest->JoinFullMember = Src->JoinFullMember; + Dest->JoinSendOnlyMember = Src->JoinSendOnlyMember; + Dest->JoinNonMember = Src->JoinNonMember; + Dest->ProxyJoin = Src->ProxyJoin; + Dest->Reserved = 0; + Dest->Reserved2 = 0; + Dest->Reserved3[0] = 0; + Dest->Reserved3[1] = 0; +} + +static __inline uint64 +REBUILD_COMPMSK_IB2STL_MCMEMBER_RECORD(uint64 mask) +{ + uint64 result = 0ull; + uint64 pos; + uint8 i; + + for (i = 0; i < 64; ++i) + { + pos = 1<member); + Dest->index = ntoh32(Dest->index); + Dest->slid = ntoh32(Dest->slid); + Dest->nodeGuid = ntoh64(Dest->nodeGuid); + Dest->portGuid = ntoh64(Dest->portGuid); +} + +static __inline void +BSWAPCOPY_STL_MCMEMBER_SYNCDB(STL_MCMEMBER_SYNCDB* Src, STL_MCMEMBER_SYNCDB* Dest) +{ + memcpy(Dest, Src, sizeof(STL_MCMEMBER_SYNCDB)); + BSWAP_STL_MCMEMBER_SYNCDB(Dest); +} + +static __inline void +BSWAP_STL_SMINFO_RECORD(STL_SMINFO_RECORD *Dest) +{ + Dest->RID.LID = ntoh32(Dest->RID.LID); + BSWAP_STL_SM_INFO(&Dest->SMInfo); +} + +static __inline void +BSWAPCOPY_STL_SMINFO_RECORD(STL_SMINFO_RECORD *Src, STL_SMINFO_RECORD *Dest) +{ + Dest->RID.LID = ntoh32(Src->RID.LID); + BSWAPCOPY_STL_SM_INFO(&Src->SMInfo, &Dest->SMInfo); +} + +static __inline void +BSWAP_STL_INFORM_INFO_RECORD(STL_INFORM_INFO_RECORD *Dest) +{ + Dest->RID.SubscriberLID = ntoh32(Dest->RID.SubscriberLID); + Dest->RID.Enum = ntoh16(Dest->RID.Enum); + BSWAP_STL_INFORM_INFO(&Dest->InformInfoData); +} + +static __inline void +BSWAPCOPY_STL_INFORM_INFO_RECORD(STL_INFORM_INFO_RECORD *Src, STL_INFORM_INFO_RECORD *Dest) +{ + Dest->RID.SubscriberLID = ntoh32(Src->RID.SubscriberLID); + Dest->RID.Enum = ntoh16(Src->RID.Enum); + BSWAPCOPY_STL_INFORM_INFO(&Src->InformInfoData, &Dest->InformInfoData); +} + +static __inline void +BSWAP_STL_LINK_RECORD(STL_LINK_RECORD *Dest) +{ + Dest->RID.FromLID = ntoh32(Dest->RID.FromLID); + Dest->ToLID = ntoh32(Dest->ToLID); +} + +static __inline void +BSWAPCOPY_STL_LINK_RECORD(STL_LINK_RECORD *Src, STL_LINK_RECORD *Dest) +{ + memcpy(Dest, Src, sizeof(STL_LINK_RECORD)); + BSWAP_STL_LINK_RECORD(Dest); +} + +static __inline void +BSWAP_STL_SERVICE_RECORD( STL_SERVICE_RECORD *Dest) +{ +#if CPU_LE + uint8 i; + + Dest->RID.ServiceID = ntoh64(Dest->RID.ServiceID); + Dest->RID.ServiceLID = ntoh32(Dest->RID.ServiceLID); + Dest->RID.ServiceP_Key = ntoh16(Dest->RID.ServiceP_Key); + BSWAP_IB_GID(&Dest->RID.ServiceGID); + + Dest->ServiceLease = ntoh32(Dest->ServiceLease); + ntoh(&Dest->ServiceKey[0], &Dest->ServiceKey[0], 16); + + Dest->Reserved = 0; + + for (i=0; i<8; ++i) + { + Dest->ServiceData16[i] = ntoh16(Dest->ServiceData16[i]); + } + for (i=0; i<4; ++i) + { + Dest->ServiceData32[i] = ntoh32(Dest->ServiceData32[i]); + } + for (i=0; i<2; ++i) + { + Dest->ServiceData64[i] = ntoh64(Dest->ServiceData64[i]); + } +#endif /* CPU_LE */ +} + +static __inline void BSWAPCOPY_STL_SERVICE_RECORD(STL_SERVICE_RECORD *Src, STL_SERVICE_RECORD *Dest) +{ + memcpy(Dest, Src, sizeof(STL_SERVICE_RECORD)); + BSWAP_STL_SERVICE_RECORD(Dest); +} + +static __inline void +BSWAP_STL_TRACE_RECORD(STL_TRACE_RECORD *Dest) +{ +#if CPU_LE + Dest->IDGeneration = ntoh16(Dest->IDGeneration); + Dest->NodeID = ntoh64(Dest->NodeID); + Dest->ChassisID = ntoh64(Dest->ChassisID); + Dest->EntryPortID = ntoh64(Dest->EntryPortID); + Dest->ExitPortID = ntoh64(Dest->ExitPortID); +#endif /* CPU_LE */ +} + +static __inline void +BSWAPCOPY_STL_TRACE_RECORD(STL_TRACE_RECORD *Src, STL_TRACE_RECORD *Dest) +{ +#if CPU_LE + memcpy(Dest,Src,sizeof(STL_TRACE_RECORD)); + BSWAP_STL_TRACE_RECORD(Dest); +#endif /* CPU_LE */ +} + +static __inline void +BSWAP_STL_CABLE_INFO_RECORD(STL_CABLE_INFO_RECORD *Dest) +{ + Dest->LID = ntoh32(Dest->LID); + Dest->u1.AsReg16 = ntoh16(Dest->u1.AsReg16); +} + +static __inline void +BSWAPCOPY_STL_CABLE_INFO_RECORD(STL_CABLE_INFO_RECORD *Src, STL_CABLE_INFO_RECORD *Dest) +{ + *Dest = *Src; + BSWAP_STL_CABLE_INFO_RECORD(Dest); +} + +static __inline void +BSWAP_STL_VFINFO_RECORD(STL_VFINFO_RECORD *Dest) +{ + Dest->vfIndex = ntoh16(Dest->vfIndex); + Dest->pKey = ntoh16(Dest->pKey); + Dest->ServiceID = ntoh64(Dest->ServiceID); + BSWAP_IB_GID(&Dest->MGID); +} + +static __inline void +BSWAPCOPY_STL_VFINFO_RECORD(STL_VFINFO_RECORD *Src, STL_VFINFO_RECORD *Dest) +{ + *Dest = *Src; + BSWAP_STL_VFINFO_RECORD(Dest); + +} + +static __inline void +BSWAP_STL_QUARANTINED_NODE_RECORD(STL_QUARANTINED_NODE_RECORD *Dest) +{ + Dest->trustedLid = ntoh32(Dest->trustedLid); + Dest->trustedNodeGUID = ntoh64(Dest->trustedNodeGUID); + Dest->trustedNeighborNodeGUID = ntoh64(Dest->trustedNeighborNodeGUID); + Dest->quarantineReasons = ntoh32(Dest->quarantineReasons); + Dest->expectedNodeInfo.nodeGUID = ntoh64(Dest->expectedNodeInfo.nodeGUID); + Dest->expectedNodeInfo.portGUID = ntoh64(Dest->expectedNodeInfo.portGUID); + BSWAP_STL_NODE_INFO(&Dest->NodeInfo); +} + +static __inline void +BSWAPCOPY_STL_QUARANTINED_NODE_RECORD(STL_QUARANTINED_NODE_RECORD *Src, STL_QUARANTINED_NODE_RECORD *Dest) +{ + Dest->trustedLid = ntoh32(Src->trustedLid); + Dest->trustedNodeGUID = ntoh64(Src->trustedNodeGUID); + Dest->trustedPortNum = Src->trustedPortNum; + Dest->trustedNeighborNodeGUID = ntoh64(Src->trustedNeighborNodeGUID); + Dest->quarantineReasons = ntoh32(Src->quarantineReasons); + Dest->expectedNodeInfo.nodeGUID = ntoh64(Src->expectedNodeInfo.nodeGUID); + Dest->expectedNodeInfo.portGUID = ntoh64(Src->expectedNodeInfo.portGUID); + BSWAPCOPY_STL_NODE_INFO(&Src->NodeInfo, &Dest->NodeInfo); + memcpy(&(Dest->NodeDesc), &(Src->NodeDesc), sizeof(STL_NODE_DESCRIPTION)); + memcpy(&(Dest->expectedNodeInfo.nodeDesc), &(Src->expectedNodeInfo.nodeDesc), sizeof(STL_NODE_DESCRIPTION)); +} + +static __inline void +BSWAP_STL_CONGESTION_INFO_RECORD(STL_CONGESTION_INFO_RECORD *Dest) +{ + Dest->LID = ntoh32(Dest->LID); + Dest->reserved = ntoh32(Dest->reserved); + BSWAP_STL_CONGESTION_INFO(&Dest->CongestionInfo); +} + +static __inline void +BSWAPCOPY_STL_CONGESTION_INFO_RECORD(STL_CONGESTION_INFO_RECORD *Src, STL_CONGESTION_INFO_RECORD *Dest) +{ + Dest->LID = ntoh32(Src->LID); + Dest->reserved = ntoh32(Src->reserved); + memcpy(&(Dest->CongestionInfo), &(Src->CongestionInfo), sizeof(STL_CONGESTION_INFO)); + BSWAP_STL_CONGESTION_INFO(&Dest->CongestionInfo); +} + +static __inline void +BSWAP_STL_SWITCH_CONGESTION_SETTING_RECORD(STL_SWITCH_CONGESTION_SETTING_RECORD *Dest) +{ + Dest->LID = ntoh32(Dest->LID); + Dest->reserved = ntoh32(Dest->reserved); + BSWAP_STL_SWITCH_CONGESTION_SETTING(&Dest->SwitchCongestionSetting); +} +static __inline void +BSWAPCOPY_STL_SWITCH_CONGESTION_SETTING_RECORD(STL_SWITCH_CONGESTION_SETTING_RECORD *Src, STL_SWITCH_CONGESTION_SETTING_RECORD *Dest) +{ + Dest->LID = ntoh32(Src->LID); + Dest->reserved = ntoh32(Src->reserved); + memcpy(&(Dest->SwitchCongestionSetting), &(Src->SwitchCongestionSetting), sizeof(STL_SWITCH_CONGESTION_SETTING)); + BSWAP_STL_SWITCH_CONGESTION_SETTING(&Dest->SwitchCongestionSetting); +} + +static __inline void +BSWAP_STL_SWITCH_PORT_CONGESTION_SETTING_RECORD(STL_SWITCH_PORT_CONGESTION_SETTING_RECORD *Dest) +{ + Dest->RID.LID = ntoh32(Dest->RID.LID); + BSWAP_STL_SWITCH_PORT_CONGESTION_SETTING(&Dest->SwitchPortCongestionSetting, 1); +} +static __inline void +BSWAPCOPY_STL_SWITCH_PORT_CONGESTION_SETTING_RECORD(STL_SWITCH_PORT_CONGESTION_SETTING_RECORD *Src, STL_SWITCH_PORT_CONGESTION_SETTING_RECORD *Dest) +{ + *Dest = *Src; + BSWAP_STL_SWITCH_PORT_CONGESTION_SETTING_RECORD(Dest); +} + +static __inline void +BSWAP_STL_HFI_CONGESTION_SETTING_RECORD(STL_HFI_CONGESTION_SETTING_RECORD *Dest) +{ + Dest->LID = ntoh32(Dest->LID); + Dest->reserved = ntoh32(Dest->reserved); + BSWAP_STL_HFI_CONGESTION_SETTING(&Dest->HFICongestionSetting); +} +static __inline void +BSWAPCOPY_STL_HFI_CONGESTION_SETTING_RECORD(STL_HFI_CONGESTION_SETTING_RECORD *Src, STL_HFI_CONGESTION_SETTING_RECORD *Dest) +{ + Dest->LID = ntoh32(Src->LID); + Dest->reserved = ntoh32(Src->reserved); + memcpy(&(Dest->HFICongestionSetting), &(Src->HFICongestionSetting), sizeof(STL_HFI_CONGESTION_SETTING)); + BSWAP_STL_HFI_CONGESTION_SETTING(&Dest->HFICongestionSetting); +} + +static __inline void +BSWAP_STL_HFI_CONGESTION_CONTROL_TABLE_RECORD(STL_HFI_CONGESTION_CONTROL_TABLE_RECORD *Dest) +{ + Dest->RID.LID = ntoh32(Dest->RID.LID); + Dest->RID.BlockNum = ntoh16(Dest->RID.BlockNum); + Dest->reserved = ntoh16(Dest->reserved); + BSWAP_STL_HFI_CONGESTION_CONTROL_TABLE(&Dest->HFICongestionControlTable, 1); +} +static __inline void +BSWAPCOPY_STL_HFI_CONGESTION_CONTROL_TABLE_RECORD(STL_HFI_CONGESTION_CONTROL_TABLE_RECORD *Src, STL_HFI_CONGESTION_CONTROL_TABLE_RECORD *Dest) +{ + Dest->RID.LID = ntoh32(Src->RID.LID); + Dest->RID.BlockNum = ntoh16(Src->RID.BlockNum); + Dest->reserved = ntoh16(Src->reserved); + memcpy(&(Dest->HFICongestionControlTable), &(Src->HFICongestionControlTable), sizeof(STL_HFI_CONGESTION_CONTROL_TABLE)); + BSWAP_STL_HFI_CONGESTION_CONTROL_TABLE(&Dest->HFICongestionControlTable, 1); +} + +static __inline void +BSWAP_STL_BUFFER_CONTROL_TABLE_RECORD(STL_BUFFER_CONTROL_TABLE_RECORD *Dest) +{ + Dest->RID.LID = ntoh32(Dest->RID.LID); + BSWAP_STL_BUFFER_CONTROL_TABLE(&Dest->BufferControlTable); +} + +static __inline void +BSWAPCOPY_STL_BUFFER_CONTROL_TABLE_RECORD(STL_BUFFER_CONTROL_TABLE_RECORD *Src, STL_BUFFER_CONTROL_TABLE_RECORD *Dest) +{ + memcpy(Dest, Src, sizeof(STL_BUFFER_CONTROL_TABLE_RECORD)); + BSWAP_STL_BUFFER_CONTROL_TABLE_RECORD(Dest); +} + +static __inline void +BSWAP_STL_FABRICINFO_RECORD( + STL_FABRICINFO_RECORD *Dest + ) +{ +#if CPU_LE + Dest->NumHFIs = ntoh32(Dest->NumHFIs); + Dest->NumSwitches = ntoh32(Dest->NumSwitches); + Dest->NumInternalHFILinks = ntoh32(Dest->NumInternalHFILinks); + Dest->NumExternalHFILinks = ntoh32(Dest->NumExternalHFILinks); + Dest->NumInternalISLs = ntoh32(Dest->NumInternalISLs); + Dest->NumExternalISLs = ntoh32(Dest->NumExternalISLs); + Dest->NumDegradedHFILinks = ntoh32(Dest->NumDegradedHFILinks); + Dest->NumDegradedISLs = ntoh32(Dest->NumDegradedISLs); + Dest->NumOmittedHFILinks = ntoh32(Dest->NumOmittedHFILinks); + Dest->NumOmittedISLs = ntoh32(Dest->NumOmittedISLs); +#endif /* CPU_LE */ +} + +static __inline void +BSWAP_STL_SWITCH_COST(STL_SWITCH_COST *cost) +{ + cost->DLID = ntoh32(cost->DLID); + cost->value = ntoh16(cost->value); +} + +static __inline void +BSWAP_STL_SWITCH_COST_RECORD(STL_SWITCH_COST_RECORD *record) +{ + int i; + + record->SLID = ntoh32(record->SLID); + for (i = 0; i < STL_SWITCH_COST_NUM_ENTRIES; ++i) { + BSWAP_STL_SWITCH_COST(record->Cost); + } +} + +// +// OpaServiceRecord_t - This is the same as the original with a +// timestamp appended. +// +typedef struct { + STL_SERVICE_RECORD serviceRecord; + uint64_t expireTime; + uint8_t pkeyDefined;// was the record created using pkey mask? +} OpaServiceRecord_t; +typedef OpaServiceRecord_t * OpaServiceRecordp; /* pointer to record */ + +#include "iba/public/ipackoff.h" + +#if defined (__cplusplus) +} +#endif +#endif //__STL_SA_PRIV_H__ + diff --git a/IbAccess/Common/Inc/stl_sa.h b/IbAccess/Common/Inc/stl_sa_types.h similarity index 66% rename from IbAccess/Common/Inc/stl_sa.h rename to IbAccess/Common/Inc/stl_sa_types.h index f928889c..2d3a6241 100644 --- a/IbAccess/Common/Inc/stl_sa.h +++ b/IbAccess/Common/Inc/stl_sa_types.h @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT7 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -59,21 +59,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * (5) The use of "Jumbo" (>256 byte) MADs are only used when needed. For * table-based MADs, RMPP is the preferred solution. * - * (6) Since this document is still in flux, the actual attribute ID values - * are not yet defined. This task can be safely postponed until the - * completion of the spec. However, MADs which are STL equivalents of IB - * MADs will have the same attribute ID as the IB equivalent. */ #ifndef __STL_SA_H__ #define __STL_SA_H__ -#include "iba/stl_sm.h" -#include "iba/stl_mad.h" +#include "iba/stl_mad_types.h" #include "iba/ib_sa_records.h" -#define NO_STL_MCMEMBER_RECORD // SA shouldn't support STL McMember Record - #if defined (__cplusplus) extern "C" { #endif @@ -136,6 +129,9 @@ extern "C" { #define STL_SA_ATTR_HFI_CONG_RECORD 0x0094 // Previously vendor specific #define STL_SA_ATTR_HFI_CONG_CTRL_RECORD 0x0095 // Previously vendor specific + +#define STL_SA_ATTR_SWITCH_COST_RECORD 0x00A3 + //#define STL_SA_ATTR_JOB_ROUTE_RECORD 0xffb2 // Never implemented. //#define STL_SA_ATTR_CG_RECORD 0xff40 // Never implemented. //#define STL_SA_ATTR_CG_STATUS_RECORD 0xff41 // Never implemented. @@ -152,10 +148,12 @@ extern "C" { #define STL_SA_CAPABILITY_PORTINFO_CAPMASK_MATCH 0x2000 #define STL_SA_CAPABILITY_PA_SERVICES_SUPPORT 0x8000 -#define STL_SA_CAPABILITY2_QOS_SUPPORT 0x0002 -#define STL_SA_CAPABILITY2_MFTTOP_SUPPORT 0x0008 -#define STL_SA_CAPABILITY2_FULL_PORTINFO 0x0040 -#define STL_SA_CAPABILITY2_EXT_SUPPORT 0x0080 +/* 32 bit values, lower 27 bits are capabilities*/ +#define STL_SA_CAPABILITY2_QOS_SUPPORT 0x0000002 +#define STL_SA_CAPABILITY2_MFTTOP_SUPPORT 0x0000008 +#define STL_SA_CAPABILITY2_FULL_PORTINFO 0x0000040 +#define STL_SA_CAPABILITY2_EXT_SUPPORT 0x0000080 +#define STL_SA_CAPABILITY2_SWCOSTRECORD_SUPPORT 0x2000000 static __inline void StlSaClassPortInfoCapMask(char buf[80], uint16 cmask) @@ -180,85 +178,15 @@ StlSaClassPortInfoCapMask2(char buf[80], uint32 cmask) if (!cmask) { snprintf(buf, 80, "-"); } else { - snprintf(buf, 80, "%s%s%s%s", + snprintf(buf, 80, "%s%s%s%s%s", (cmask & STL_SA_CAPABILITY2_QOS_SUPPORT) ? "QoS " : "", (cmask & STL_SA_CAPABILITY2_MFTTOP_SUPPORT) ? "MFTTop " : "", (cmask & STL_SA_CAPABILITY2_FULL_PORTINFO) ? "FullPortInfo " : "", - (cmask & STL_SA_CAPABILITY2_EXT_SUPPORT) ? "ExtSpeed " : ""); + (cmask & STL_SA_CAPABILITY2_EXT_SUPPORT) ? "ExtSpeed " : "", + (cmask & STL_SA_CAPABILITY2_SWCOSTRECORD_SUPPORT) ? "SwCost " : ""); } } - -// Replaces old Vieo macro that converts a single GID argument into two arguments -// that can be used in a print statement. -#define STLGIDPRINTARGS(GID) ntoh64((GID).Type.Global.SubnetPrefix), \ - ntoh64((GID).Type.Global.InterfaceID) - -#define STLGIDPRINTARGS2(GID) ntoh64(alignArray64(&GID[0])), ntoh64(alignArray64(&GID[8])) -static __inline__ uint64_t -_alignArray64(uint8_t * array) { uint64_t rv; memcpy(&rv, array, sizeof(rv));return rv;} - -/* - * SA Header - */ -typedef struct { - uint8_t rmppVersion; - uint8_t rmppType; - union { - struct { - #if CPU_BE - uint8_t rmppRespTime : 5; - uint8_t rmppFlags : 3; - #else - uint8_t rmppFlags : 3; - uint8_t rmppRespTime : 5; - #endif - } tf; - uint8_t timeFlag; - } u; - uint8_t rmppStatus; - uint32_t segNum; - uint32_t length; - uint64_t smKey; - uint16_t offset; - uint16_t rservd; - uint64_t mask; -} PACK_SUFFIX STL_SA_MAD_HEADER; - -#define STL_SA_DATA_LEN (STL_MAD_BLOCK_SIZE-sizeof(STL_SA_MAD_HEADER)-sizeof(MAD_COMMON)) - -typedef struct { - STL_SA_MAD_HEADER header; - uint8_t data[STL_SA_DATA_LEN]; -} PACK_SUFFIX STL_SA_MAD; - -static __inline -void -BSWAPCOPY_STL_SA_MAD_HEADER(STL_SA_MAD_HEADER *src, STL_SA_MAD_HEADER *dst) -{ - dst->rmppVersion = src->rmppVersion; - dst->rmppType = src->rmppType; - dst->rmppStatus = src->rmppStatus; - dst->u.timeFlag = src->u.timeFlag; - - dst->segNum = ntoh32(src->segNum); - dst->length = ntoh32(src->length); - dst->smKey = ntoh64(src->smKey); - dst->offset = ntoh16(src->offset); - dst->rservd = ntoh16(src->rservd); - dst->mask = ntoh64(src->mask); -} - -static __inline -void -BSWAPCOPY_STL_SA_MAD(STL_SA_MAD *src, STL_SA_MAD *dst, size_t len) -{ - BSWAPCOPY_STL_SA_MAD_HEADER(&src->header,&dst->header); - memcpy(&dst->data, &src->data, len); -} - - - /* * NodeRecord * @@ -279,30 +207,6 @@ typedef struct { } PACK_SUFFIX STL_NODE_RECORD; -static __inline -void -BSWAP_STL_NODE_RECORD(STL_NODE_RECORD *Dest) { - Dest->RID.LID = ntoh32(Dest->RID.LID); - BSWAP_STL_NODE_INFO(&Dest->NodeInfo); -} - -static __inline -void -BSWAPCOPY_STL_NODE_RECORD(STL_NODE_RECORD *Src, STL_NODE_RECORD *Dest) { - Dest->RID.LID = ntoh32(Src->RID.LID); - BSWAPCOPY_STL_NODE_INFO(&Src->NodeInfo, &Dest->NodeInfo); - memcpy(&(Dest->NodeDesc), &(Src->NodeDesc), sizeof(STL_NODE_DESCRIPTION)); -} - -static __inline -void -BSWAPCOPY_IB_NODE_RECORD(IB_NODE_RECORD *Src, IB_NODE_RECORD *Dest) { - Dest->RID.AsReg32 = ntoh32(Src->RID.AsReg32); - memcpy(&Dest->NodeInfoData,&Src->NodeInfoData,sizeof(NODE_INFO)); - BSWAP_NODE_INFO(&Dest->NodeInfoData); - memcpy(&(Dest->NodeDescData), &(Src->NodeDescData), sizeof(NODE_DESCRIPTION)); -} - /* ComponentMask bits */ #define STL_NODE_RECORD_COMP_LID 0x00000001 /* reserved field 0x00000002 */ @@ -321,8 +225,6 @@ BSWAPCOPY_IB_NODE_RECORD(IB_NODE_RECORD *Src, IB_NODE_RECORD *Dest) { #define STL_NODE_RECORD_COMP_VENDORID 0x00004000 #define STL_NODE_RECORD_COMP_NODEDESC 0x00008000 - - /* * PortInfoRecord * @@ -396,22 +298,6 @@ typedef struct { } PACK_SUFFIX STL_PORTINFO_RECORD; -static __inline -void -BSWAP_STL_PORTINFO_RECORD(STL_PORTINFO_RECORD *Dest) -{ -#if CPU_LE - int i; - - Dest->RID.EndPortLID = ntoh32(Dest->RID.EndPortLID); - BSWAP_STL_PORT_INFO(&Dest->PortInfo); - - for(i = 0; i < STL_NUM_LINKDOWN_REASONS; i++){ - Dest->LinkDownReasons[i].Timestamp = ntoh64(Dest->LinkDownReasons[i].Timestamp); - } -#endif -} - /* ComponentMask bits */ /* * The component mask bits for port info deviate from the IB standard @@ -451,24 +337,6 @@ typedef struct { #define STL_PKEYTABLE_RECORD_COMP_BLOCKNUM 0x00000002 #define STL_PKEYTABLE_RECORD_COMP_PORTNUM 0x00000004 -static __inline -void -BSWAP_STL_PARTITION_TABLE_RECORD(STL_P_KEY_TABLE_RECORD *Dest) -{ - Dest->RID.LID = ntoh32(Dest->RID.LID); - Dest->RID.Blocknum = ntoh16(Dest->RID.Blocknum); - BSWAP_STL_PARTITION_TABLE(&Dest->PKeyTblData); -} - -static __inline -void -BSWAPCOPY_STL_PARTITION_TABLE_RECORD(STL_P_KEY_TABLE_RECORD *Src, STL_P_KEY_TABLE_RECORD *Dest) -{ - memcpy(Dest, Src, sizeof(STL_P_KEY_TABLE_RECORD)); - BSWAP_STL_PARTITION_TABLE_RECORD(Dest); -} - - /* * SCMappingTableRecord * @@ -499,22 +367,6 @@ typedef struct { #define STL_SC2SC_RECORD_COMP_INPUTPORT 0x0000000000000002ull #define STL_SC2SC_RECORD_COMP_OUTPUTPORT 0x0000000000000004ull -static __inline -void -BSWAP_STL_SC_MAPPING_TABLE_RECORD(STL_SC_MAPPING_TABLE_RECORD *Dest) -{ - Dest->RID.LID = ntoh32(Dest->RID.LID); -} - -static __inline -void -BSWAPCOPY_STL_SC_MAPPING_TABLE_RECORD(STL_SC_MAPPING_TABLE_RECORD *Src, STL_SC_MAPPING_TABLE_RECORD *Dest) -{ - memcpy(Dest, Src, sizeof(STL_SC_MAPPING_TABLE_RECORD)); - BSWAP_STL_SC_MAPPING_TABLE_RECORD(Dest); -} - - /* * SL2SCMappingTableRecord * @@ -535,21 +387,6 @@ typedef struct { #define STL_SL2SC_RECORD_COMP_LID 0x0000000000000001ull -static __inline -void -BSWAP_STL_SL2SC_MAPPING_TABLE_RECORD(STL_SL2SC_MAPPING_TABLE_RECORD *Dest) -{ - Dest->RID.LID=ntoh32(Dest->RID.LID); -} - -static __inline -void -BSWAPCOPY_STL_SL2SC_MAPPING_TABLE_RECORD(STL_SL2SC_MAPPING_TABLE_RECORD *Src, STL_SL2SC_MAPPING_TABLE_RECORD *Dest) -{ - memcpy(Dest, Src, sizeof(STL_SL2SC_MAPPING_TABLE_RECORD)); - BSWAP_STL_SL2SC_MAPPING_TABLE_RECORD(Dest); -} - /* * SC2SLMappingTableRecord * @@ -570,21 +407,6 @@ typedef struct { #define STL_SC2SL_RECORD_COMP_LID 0x0000000000000001ull -static __inline -void -BSWAP_STL_SC2SL_MAPPING_TABLE_RECORD(STL_SC2SL_MAPPING_TABLE_RECORD *Dest) -{ - Dest->RID.LID=ntoh32(Dest->RID.LID); -} - -static __inline -void -BSWAPCOPY_STL_SC2SL_MAPPING_TABLE_RECORD(STL_SC2SL_MAPPING_TABLE_RECORD *Src, STL_SC2SL_MAPPING_TABLE_RECORD *Dest) -{ - memcpy(Dest, Src, sizeof(STL_SC2SL_MAPPING_TABLE_RECORD)); - BSWAP_STL_SC2SL_MAPPING_TABLE_RECORD(Dest); -} - /* * SC2VL Mapping Table Records * @@ -610,21 +432,6 @@ typedef STL_SC2VL_R_MAPPING_TABLE_RECORD STL_SC2PVL_NT_MAPPING_TABLE_RECORD; #define STL_SC2VL_R_RECORD_COMP_LID 0x0000000000000001ull #define STL_SC2VL_R_RECORD_COMP_PORT 0x0000000000000002ull -static __inline -void -BSWAP_STL_SC2VL_R_MAPPING_TABLE_RECORD(STL_SC2VL_R_MAPPING_TABLE_RECORD *Dest) -{ - Dest->RID.LID=ntoh32(Dest->RID.LID); -} - -static __inline -void -BSWAPCOPY_STL_SC2VL_R_MAPPING_TABLE_RECORD(STL_SC2VL_R_MAPPING_TABLE_RECORD *Src, STL_SC2VL_R_MAPPING_TABLE_RECORD *Dest) -{ - memcpy(Dest, Src, sizeof(STL_SC2VL_R_MAPPING_TABLE_RECORD)); - BSWAP_STL_SC2VL_R_MAPPING_TABLE_RECORD(Dest); -} - /* * SwitchInfoRecord * @@ -685,22 +492,6 @@ typedef struct { #define STL_SWITCHINFO_RECORD_COMP_CAPMASK 0x0000010000000000ull #define STL_SWITCHINFO_RECORD_COMP_CMCOLLECTIVES 0x0000020000000000ull -static __inline -void -BSWAPCOPY_STL_SWITCHINFO_RECORD(STL_SWITCHINFO_RECORD *Src, STL_SWITCHINFO_RECORD *Dest) { - Dest->RID.LID = ntoh32(Src->RID.LID); - BSWAPCOPY_STL_SWITCH_INFO(&Src->SwitchInfoData, &Dest->SwitchInfoData); -} - -static __inline -void -BSWAP_STL_SWITCHINFO_RECORD(STL_SWITCHINFO_RECORD *Dest) { - Dest->RID.LID = ntoh32(Dest->RID.LID); - BSWAP_STL_SWITCH_INFO(&Dest->SwitchInfoData); -} - - - /* * LFTRecord * @@ -730,26 +521,6 @@ typedef struct { /* Reserved 0x0000000000000002ull */ #define STL_LFT_RECORD_COMP_BLOCKNUM 0x0000000000000004ull -static __inline -void -BSWAP_STL_LINEAR_FORWARDING_TABLE_RECORD(STL_LINEAR_FORWARDING_TABLE_RECORD *Dest) -{ - Dest->RID.LID = ntoh32(Dest->RID.LID); - (*(uint32*)((char *)Dest + sizeof(uint32))) = ntoh32(*(uint32*)((char *)Dest + sizeof(uint32))); - BSWAP_STL_LINEAR_FORWARDING_TABLE((STL_LINEAR_FORWARDING_TABLE *)Dest->LinearFdbData); -} - -static __inline -void -BSWAPCOPY_STL_LINEAR_FORWARDING_TABLE_RECORD(STL_LINEAR_FORWARDING_TABLE_RECORD *Src, STL_LINEAR_FORWARDING_TABLE_RECORD *Dest) -{ - memcpy(Dest, Src, sizeof(STL_LINEAR_FORWARDING_TABLE_RECORD)); - BSWAP_STL_LINEAR_FORWARDING_TABLE_RECORD(Dest); -} - - - - /* * MFTRecord * @@ -795,24 +566,6 @@ typedef struct _STL_MULTICAST_FORWARDING_TABLE_RECORD { #define STL_MFTB_RECORD_COMP_POSITIONl 0x0000000000000002ull /* Reserved 0x0000000000000004ull */ #define STL_MFTB_RECORD_COMP_BLOCKNUM 0x0000000000000008ull -static __inline -void -BSWAP_STL_MCFTB_RECORD(STL_MULTICAST_FORWARDING_TABLE_RECORD *Dest) -{ - int i; - Dest->RID.LID = ntoh32(Dest->RID.LID); - Dest->RID.u1.AsReg32 = ntoh32(Dest->RID.u1.AsReg32); - for (i = 0; i < STL_NUM_MFT_ELEMENTS_BLOCK; ++i) Dest->MftTable.MftBlock[i] = ntoh64(Dest->MftTable.MftBlock[i]); -} - -static __inline -void -BSWAPCOPY_STL_MCFTB_RECORD(STL_MULTICAST_FORWARDING_TABLE_RECORD *Src, STL_MULTICAST_FORWARDING_TABLE_RECORD *Dest) -{ - memcpy(Dest, Src, sizeof(STL_MULTICAST_FORWARDING_TABLE_RECORD)); - BSWAP_STL_MCFTB_RECORD(Dest); -} - /* * Port Group Table Record @@ -846,23 +599,6 @@ typedef struct { #define STL_PGTB_RECORD_COMP_LID 0x0000000000000001ull #define STL_PGTB_RECORD_COMP_POSITION 0x0000000000000002ull #define STL_PGTB_RECORD_COMP_BLOCKNUM 0x0000000000000004ull -static __inline -void -BSWAP_STL_PORT_GROUP_TABLE_RECORD(STL_PORT_GROUP_TABLE_RECORD *Dest) -{ - int i; - Dest->RID.LID = ntoh32(Dest->RID.LID); - for (i = 0; i < STL_PGTB_NUM_ENTRIES_PER_BLOCK; ++i) Dest->GroupBlock[i] = ntoh64(Dest->GroupBlock[i]); -} - -static __inline -void -BSWAPCOPY_STL_PORT_GROUP_TABLE_RECORD(STL_PORT_GROUP_TABLE_RECORD *Src, STL_PORT_GROUP_TABLE_RECORD *Dest) -{ - memcpy(Dest, Src, sizeof(STL_PORT_GROUP_TABLE_RECORD)); - BSWAP_STL_PORT_GROUP_TABLE_RECORD(Dest); -} - /* * Port Group Forwarding Table Record @@ -889,21 +625,6 @@ typedef struct { #define STL_PGFWDTB_RECORD_COMP_LID 0x0000000000000001ull #define STL_PGFWDTB_RECORD_COMP_BLOCKNUM 0x0000000000000002ull -static __inline -void -BSWAP_STL_PORT_GROUP_FORWARDING_TABLE_RECORD(STL_PORT_GROUP_FORWARDING_TABLE_RECORD *Dest) -{ - Dest->RID.LID = ntoh32(Dest->RID.LID); - Dest->RID.u1.AsReg32 = ntoh32(Dest->RID.u1.AsReg32); -} - -static __inline -void -BSWAPCOPY_STL_PORT_GROUP_FORWARDING_TABLE_RECORD(STL_PORT_GROUP_FORWARDING_TABLE_RECORD *Src, STL_PORT_GROUP_FORWARDING_TABLE_RECORD *Dest) -{ - memcpy(Dest, Src, sizeof(STL_PORT_GROUP_FORWARDING_TABLE_RECORD)); - BSWAP_STL_PORT_GROUP_FORWARDING_TABLE_RECORD(Dest); -} /* * VLArbitrationRecord @@ -931,22 +652,6 @@ typedef struct { #define STL_VLARB_COMPONENTMASK_OUTPORTNUM 0x0000000000000002ul #define STL_VLARB_COMPONENTMASK_BLOCKNUM 0x0000000000000004ul -static __inline -void -BSWAP_STL_VLARBTABLE_RECORD(STL_VLARBTABLE_RECORD *Dest) -{ - Dest->RID.LID = ntoh32(Dest->RID.LID); - BSWAP_STL_VLARB_TABLE(&Dest->VLArbTable, Dest->RID.BlockNum); -} - -static __inline -void -BSWAPCOPY_STL_VLARBTABLE_RECORD(STL_VLARBTABLE_RECORD *Src, STL_VLARBTABLE_RECORD *Dest) -{ - memcpy(Dest, Src, sizeof(STL_VLARBTABLE_RECORD)); - BSWAP_STL_VLARBTABLE_RECORD(Dest); -} - /* * MCMemberRecord * @@ -1051,147 +756,6 @@ typedef struct { | (REC)->JoinNonMember \ | (REC)->JoinFullMember ) -static __inline -void -BSWAP_STL_MCMEMBER_RECORD(STL_MCMEMBER_RECORD *Dest) { - uint64_t temp; - - temp = ntoh64(Dest->RID.MGID.AsReg64s.H); - Dest->RID.MGID.AsReg64s.H = ntoh64(Dest->RID.MGID.AsReg64s.L); - Dest->RID.MGID.AsReg64s.L = temp; - - temp = ntoh64(Dest->RID.PortGID.AsReg64s.H); - Dest->RID.PortGID.AsReg64s.H = ntoh64(Dest->RID.PortGID.AsReg64s.L); - Dest->RID.PortGID.AsReg64s.L = temp; - - Dest->Q_Key = ntoh32(Dest->Q_Key); - Dest->P_Key = ntoh16(Dest->P_Key); - *(uint32*)((uint8*)Dest + 44) = ntoh32( *(uint32*)( (uint8*)Dest + 44) ); - Dest->MLID = ntoh32(Dest->MLID); -} - -static __inline -void -BSWAPCOPY_STL_MCMEMBER_RECORD(STL_MCMEMBER_RECORD *Src, STL_MCMEMBER_RECORD *Dest) -{ - memcpy(Dest, Src, sizeof(STL_MCMEMBER_RECORD)); - BSWAP_STL_MCMEMBER_RECORD(Dest); -} - -static __inline -void -CONVERT_IB2STL_MCMEMBER_RECORD(IB_MCMEMBER_RECORD *Src, STL_MCMEMBER_RECORD *Dest) -{ - Dest->RID.MGID = Src->RID.MGID; - Dest->RID.PortGID = Src->RID.PortGID; - Dest->Q_Key = Src->Q_Key; - Dest->MLID = Src->MLID; - Dest->MtuSelector = Src->MtuSelector; - Dest->Mtu = Src->Mtu; - Dest->TClass = Src->TClass; - Dest->P_Key = Src->P_Key; - Dest->RateSelector = Src->RateSelector; - Dest->Rate = Src->Rate; - Dest->PktLifeTimeSelector = Src->PktLifeTimeSelector; - Dest->PktLifeTime = Src->PktLifeTime; - Dest->SL = Src->u1.s.SL; - Dest->HopLimit = Src->u1.s.HopLimit; - Dest->Scope = Src->Scope; - Dest->JoinFullMember = Src->JoinFullMember; - Dest->JoinSendOnlyMember = Src->JoinSendOnlyMember; - Dest->JoinNonMember = Src->JoinNonMember; - Dest->ProxyJoin = Src->ProxyJoin; -} - -static __inline -void -CONVERT_STL2IB_MCMEMBER_RECORD(STL_MCMEMBER_RECORD *Src, IB_MCMEMBER_RECORD *Dest) -{ - Dest->RID.MGID = Src->RID.MGID; - Dest->RID.PortGID = Src->RID.PortGID; - Dest->Q_Key = Src->Q_Key; - Dest->MLID = Src->MLID; - Dest->MtuSelector = Src->MtuSelector; - Dest->Mtu = Src->Mtu; - Dest->TClass = Src->TClass; - Dest->P_Key = Src->P_Key; - Dest->RateSelector = Src->RateSelector; - Dest->Rate = Src->Rate; - Dest->PktLifeTimeSelector = Src->PktLifeTimeSelector; - Dest->PktLifeTime = Src->PktLifeTime; - Dest->u1.s.SL = Src->SL; - Dest->u1.s.FlowLabel = 0; - Dest->u1.s.HopLimit = Src->HopLimit; - Dest->Scope = Src->Scope; - Dest->JoinFullMember = Src->JoinFullMember; - Dest->JoinSendOnlyMember = Src->JoinSendOnlyMember; - Dest->JoinNonMember = Src->JoinNonMember; - Dest->ProxyJoin = Src->ProxyJoin; - Dest->Reserved = 0; - Dest->Reserved2 = 0; - Dest->Reserved3[0] = 0; - Dest->Reserved3[1] = 0; -} - -static __inline -uint64 -REBUILD_COMPMSK_IB2STL_MCMEMBER_RECORD(uint64 mask) -{ - uint64 result = 0ull; - uint64 pos; - uint8 i; - - for (i = 0; i < 64; ++i) - { - pos = 1<member); - Dest->index = ntoh32(Dest->index); - Dest->slid = ntoh32(Dest->slid); - Dest->nodeGuid = ntoh64(Dest->nodeGuid); - Dest->portGuid = ntoh64(Dest->portGuid); -} -static __inline -void -BSWAPCOPY_STL_MCMEMBER_SYNCDB(STL_MCMEMBER_SYNCDB* Src, STL_MCMEMBER_SYNCDB* Dest) -{ - memcpy(Dest, Src, sizeof(STL_MCMEMBER_SYNCDB)); - BSWAP_STL_MCMEMBER_SYNCDB(Dest); -} - /* * SMInfoRecord * @@ -1211,20 +775,6 @@ typedef struct { } PACK_SUFFIX STL_SMINFO_RECORD; -static __inline -void -BSWAP_STL_SMINFO_RECORD(STL_SMINFO_RECORD *Dest) { - Dest->RID.LID = ntoh32(Dest->RID.LID); - BSWAP_STL_SM_INFO(&Dest->SMInfo); -} - -static __inline -void -BSWAPCOPY_STL_SMINFO_RECORD(STL_SMINFO_RECORD *Src, STL_SMINFO_RECORD *Dest) { - Dest->RID.LID = ntoh32(Src->RID.LID); - BSWAPCOPY_STL_SM_INFO(&Src->SMInfo, &Dest->SMInfo); -} - #define STL_SMINFO_RECORD_COMP_LID 0x0000000000000001ull /* Reserved 0x0000000000000002ull */ #define STL_SMINFO_RECORD_COMP_GUID 0x0000000000000004ull @@ -1236,8 +786,6 @@ BSWAPCOPY_STL_SMINFO_RECORD(STL_SMINFO_RECORD *Src, STL_SMINFO_RECORD *Dest) { #define STL_SMINFO_RECORD_COMP_SMSTATEINIT 0x0000000000000100ull #define STL_SMINFO_RECORD_COMP_SMSTATECURR 0x0000000000000200ull - - /* * InformInfoRecord * @@ -1276,24 +824,6 @@ typedef struct { /* reserved 0x0000000000004000ll */ #define STL_INFORM_INFO_REC_COMP_LID_PRODUCER_TYPE 0x0000000000008000ll -static __inline -void -BSWAP_STL_INFORM_INFO_RECORD(STL_INFORM_INFO_RECORD *Dest) { - Dest->RID.SubscriberLID = ntoh32(Dest->RID.SubscriberLID); - Dest->RID.Enum = ntoh16(Dest->RID.Enum); - BSWAP_STL_INFORM_INFO(&Dest->InformInfoData); -} - -static __inline -void -BSWAPCOPY_STL_INFORM_INFO_RECORD(STL_INFORM_INFO_RECORD *Src, STL_INFORM_INFO_RECORD *Dest) { - Dest->RID.SubscriberLID = ntoh32(Src->RID.SubscriberLID); - Dest->RID.Enum = ntoh16(Src->RID.Enum); - BSWAPCOPY_STL_INFORM_INFO(&Src->InformInfoData, &Dest->InformInfoData); -} - - - /* * LinkRecord * @@ -1322,21 +852,6 @@ typedef struct _STL_LINK_RECORD { /* Reserved 0x0000000000000008ll */ #define STL_LINK_REC_COMP_TO_LID 0x0000000000000010ll -static __inline -void BSWAP_STL_LINK_RECORD(STL_LINK_RECORD *Dest) -{ - Dest->RID.FromLID = ntoh32(Dest->RID.FromLID); - Dest->ToLID = ntoh32(Dest->ToLID); -} - -static __inline -void BSWAPCOPY_STL_LINK_RECORD(STL_LINK_RECORD *Src, STL_LINK_RECORD *Dest) -{ - memcpy(Dest, Src, sizeof(STL_LINK_RECORD)); - BSWAP_STL_LINK_RECORD(Dest); -} - - /* * ServiceRecord * @@ -1414,48 +929,6 @@ typedef struct { #define STL_SERVICE_RECORD_COMP_SERVICE_64_1 0x0000002000000000ull #define STL_SERVICE_RECORD_COMP_SERVICE_64_2 0x0000004000000000ull - -static __inline -void -BSWAP_STL_SERVICE_RECORD( STL_SERVICE_RECORD *Dest) -{ -#if CPU_LE - uint8 i; - - Dest->RID.ServiceID = ntoh64(Dest->RID.ServiceID); - Dest->RID.ServiceLID = ntoh32(Dest->RID.ServiceLID); - Dest->RID.ServiceP_Key = ntoh16(Dest->RID.ServiceP_Key); - BSWAP_IB_GID(&Dest->RID.ServiceGID); - - Dest->ServiceLease = ntoh32(Dest->ServiceLease); - ntoh(&Dest->ServiceKey[0], &Dest->ServiceKey[0], 16); - - Dest->Reserved = 0; - - for (i=0; i<8; ++i) - { - Dest->ServiceData16[i] = ntoh16(Dest->ServiceData16[i]); - } - for (i=0; i<4; ++i) - { - Dest->ServiceData32[i] = ntoh32(Dest->ServiceData32[i]); - } - for (i=0; i<2; ++i) - { - Dest->ServiceData64[i] = ntoh64(Dest->ServiceData64[i]); - } -#endif /* CPU_LE */ -} - -static __inline -void BSWAPCOPY_STL_SERVICE_RECORD(STL_SERVICE_RECORD *Src, STL_SERVICE_RECORD *Dest) -{ - memcpy(Dest, Src, sizeof(STL_SERVICE_RECORD)); - BSWAP_STL_SERVICE_RECORD(Dest); -} - - - /* * ServiceAssociationRecord * @@ -1463,8 +936,6 @@ void BSWAPCOPY_STL_SERVICE_RECORD(STL_SERVICE_RECORD *Src, STL_SERVICE_RECORD *D */ typedef IB_SERVICEASSOCIATION_RECORD STL_SERVICEASSOCIATION_RECORD; - - /* * TraceRecord * @@ -1489,28 +960,6 @@ typedef struct { } PACK_SUFFIX STL_TRACE_RECORD; -static __inline void -BSWAP_STL_TRACE_RECORD(STL_TRACE_RECORD *Dest) -{ -#if CPU_LE - Dest->IDGeneration = ntoh16(Dest->IDGeneration); - Dest->NodeID = ntoh64(Dest->NodeID); - Dest->ChassisID = ntoh64(Dest->ChassisID); - Dest->EntryPortID = ntoh64(Dest->EntryPortID); - Dest->ExitPortID = ntoh64(Dest->ExitPortID); -#endif /* CPU_LE */ -} - -static __inline void -BSWAPCOPY_STL_TRACE_RECORD(STL_TRACE_RECORD *Src, STL_TRACE_RECORD *Dest) -{ -#if CPU_LE - memcpy(Dest,Src,sizeof(STL_TRACE_RECORD)); - BSWAP_STL_TRACE_RECORD(Dest); -#endif /* CPU_LE */ -} - - /* * MultiPathRecord * @@ -1576,8 +1025,6 @@ typedef struct { IB_GID GIDList[0]; // SGIDCount + DGIDCount entries. } PACK_SUFFIX STL_MULTIPATH_RECORD_GID; - - /* * MultiPathRecord (GUID) * @@ -1641,8 +1088,6 @@ typedef struct { uint64 GUIDList[0]; // SGUIDCount + DGUIDCount entries. } PACK_SUFFIX STL_MULTIPATH_RECORD_GUID; - - /* * MultiPathRecord (LID) * @@ -1704,7 +1149,6 @@ typedef struct { uint32 LIDList[0]; // SLIDCount + DLIDCount entries } PACK_SUFFIX STL_MULTIPATH_RECORD_LID; - /* * CableInfoRecord * @@ -1737,18 +1181,6 @@ typedef struct { #define STL_CIR_COMP_ADDR 0x10ul //Reserved2 0x20ul -static __inline void -BSWAP_STL_CABLE_INFO_RECORD(STL_CABLE_INFO_RECORD *Dest) { - Dest->LID = ntoh32(Dest->LID); - Dest->u1.AsReg16 = ntoh16(Dest->u1.AsReg16); -} - -static __inline void -BSWAPCOPY_STL_CABLE_INFO_RECORD(STL_CABLE_INFO_RECORD *Src, STL_CABLE_INFO_RECORD *Dest) { - *Dest = *Src; - BSWAP_STL_CABLE_INFO_RECORD(Dest); -} - #define STL_VFABRIC_NAME_LEN 64 /* * VFInfoRecord @@ -1848,28 +1280,6 @@ typedef struct { #define STL_VFINFO_REC_OPT_QOS 0x02 #define STL_VFINFO_REC_OPT_FLOW_DISABLE 0x04 -// -// Calculate 8-byte multiple padding for multi record SA responses - -static __inline -void -BSWAP_STL_VFINFO_RECORD(STL_VFINFO_RECORD *Dest) -{ - Dest->vfIndex = ntoh16(Dest->vfIndex); - Dest->pKey = ntoh16(Dest->pKey); - Dest->ServiceID = ntoh64(Dest->ServiceID); - BSWAP_IB_GID(&Dest->MGID); -} - -static __inline -void -BSWAPCOPY_STL_VFINFO_RECORD(STL_VFINFO_RECORD *Src, STL_VFINFO_RECORD *Dest) -{ - *Dest = *Src; - BSWAP_STL_VFINFO_RECORD(Dest); - -} - /* * QuarantinedNodeRecord * @@ -1911,31 +1321,6 @@ typedef struct { } PACK_SUFFIX STL_QUARANTINED_NODE_RECORD; -static __inline void -BSWAP_STL_QUARANTINED_NODE_RECORD(STL_QUARANTINED_NODE_RECORD *Dest) { - Dest->trustedLid = ntoh32(Dest->trustedLid); - Dest->trustedNodeGUID = ntoh64(Dest->trustedNodeGUID); - Dest->trustedNeighborNodeGUID = ntoh64(Dest->trustedNeighborNodeGUID); - Dest->quarantineReasons = ntoh32(Dest->quarantineReasons); - Dest->expectedNodeInfo.nodeGUID = ntoh64(Dest->expectedNodeInfo.nodeGUID); - Dest->expectedNodeInfo.portGUID = ntoh64(Dest->expectedNodeInfo.portGUID); - BSWAP_STL_NODE_INFO(&Dest->NodeInfo); -} - -static __inline void -BSWAPCOPY_STL_QUARANTINED_NODE_RECORD(STL_QUARANTINED_NODE_RECORD *Src, STL_QUARANTINED_NODE_RECORD *Dest) { - Dest->trustedLid = ntoh32(Src->trustedLid); - Dest->trustedNodeGUID = ntoh64(Src->trustedNodeGUID); - Dest->trustedPortNum = Src->trustedPortNum; - Dest->trustedNeighborNodeGUID = ntoh64(Src->trustedNeighborNodeGUID); - Dest->quarantineReasons = ntoh32(Src->quarantineReasons); - Dest->expectedNodeInfo.nodeGUID = ntoh64(Src->expectedNodeInfo.nodeGUID); - Dest->expectedNodeInfo.portGUID = ntoh64(Src->expectedNodeInfo.portGUID); - BSWAPCOPY_STL_NODE_INFO(&Src->NodeInfo, &Dest->NodeInfo); - memcpy(&(Dest->NodeDesc), &(Src->NodeDesc), sizeof(STL_NODE_DESCRIPTION)); - memcpy(&(Dest->expectedNodeInfo.nodeDesc), &(Src->expectedNodeInfo.nodeDesc), sizeof(STL_NODE_DESCRIPTION)); -} - /* * Congestion Info Record * @@ -1949,20 +1334,6 @@ typedef struct { } PACK_SUFFIX STL_CONGESTION_INFO_RECORD; #define CIR_COMPONENTMASK_COMP_LID 0x00000001 -static __inline void -BSWAP_STL_CONGESTION_INFO_RECORD(STL_CONGESTION_INFO_RECORD *Dest) { - Dest->LID = ntoh32(Dest->LID); - Dest->reserved = ntoh32(Dest->reserved); - BSWAP_STL_CONGESTION_INFO(&Dest->CongestionInfo); -} - -static __inline void -BSWAPCOPY_STL_CONGESTION_INFO_RECORD(STL_CONGESTION_INFO_RECORD *Src, STL_CONGESTION_INFO_RECORD *Dest) { - Dest->LID = ntoh32(Src->LID); - Dest->reserved = ntoh32(Src->reserved); - memcpy(&(Dest->CongestionInfo), &(Src->CongestionInfo), sizeof(STL_CONGESTION_INFO)); - BSWAP_STL_CONGESTION_INFO(&Dest->CongestionInfo); -} /* * Switch Congestion Setting Record @@ -1977,20 +1348,6 @@ typedef struct { /* all fields are RW */ } PACK_SUFFIX STL_SWITCH_CONGESTION_SETTING_RECORD; #define SWCSR_COMPONENTMASK_COMP_LID 0x00000001 -static __inline void -BSWAP_STL_SWITCH_CONGESTION_SETTING_RECORD(STL_SWITCH_CONGESTION_SETTING_RECORD *Dest) { - Dest->LID = ntoh32(Dest->LID); - Dest->reserved = ntoh32(Dest->reserved); - BSWAP_STL_SWITCH_CONGESTION_SETTING(&Dest->SwitchCongestionSetting); -} -static __inline void -BSWAPCOPY_STL_SWITCH_CONGESTION_SETTING_RECORD(STL_SWITCH_CONGESTION_SETTING_RECORD *Src, STL_SWITCH_CONGESTION_SETTING_RECORD *Dest) { - Dest->LID = ntoh32(Src->LID); - Dest->reserved = ntoh32(Src->reserved); - memcpy(&(Dest->SwitchCongestionSetting), &(Src->SwitchCongestionSetting), sizeof(STL_SWITCH_CONGESTION_SETTING)); - BSWAP_STL_SWITCH_CONGESTION_SETTING(&Dest->SwitchCongestionSetting); -} - /* * Switch Port Congestion Setting Record @@ -2014,17 +1371,6 @@ typedef struct { #define SWPCSR_COMPONENTMASK_COMP_LID 0x00000001 #define SWPCSR_COMPONENTMASK_COMP_PORT 0x00000002 -static __inline void -BSWAP_STL_SWITCH_PORT_CONGESTION_SETTING_RECORD(STL_SWITCH_PORT_CONGESTION_SETTING_RECORD *Dest) { - Dest->RID.LID = ntoh32(Dest->RID.LID); - BSWAP_STL_SWITCH_PORT_CONGESTION_SETTING(&Dest->SwitchPortCongestionSetting, 1); -} -static __inline void -BSWAPCOPY_STL_SWITCH_PORT_CONGESTION_SETTING_RECORD(STL_SWITCH_PORT_CONGESTION_SETTING_RECORD *Src, STL_SWITCH_PORT_CONGESTION_SETTING_RECORD *Dest) { - *Dest = *Src; - BSWAP_STL_SWITCH_PORT_CONGESTION_SETTING_RECORD(Dest); -} - /* * HFI Congestion Setting Record @@ -2039,20 +1385,6 @@ typedef struct { /* all fields are RW */ } PACK_SUFFIX STL_HFI_CONGESTION_SETTING_RECORD; #define HCSR_COMPONENTMASK_COMP_LID 0x00000001 -static __inline void -BSWAP_STL_HFI_CONGESTION_SETTING_RECORD(STL_HFI_CONGESTION_SETTING_RECORD *Dest) { - Dest->LID = ntoh32(Dest->LID); - Dest->reserved = ntoh32(Dest->reserved); - BSWAP_STL_HFI_CONGESTION_SETTING(&Dest->HFICongestionSetting); -} -static __inline void -BSWAPCOPY_STL_HFI_CONGESTION_SETTING_RECORD(STL_HFI_CONGESTION_SETTING_RECORD *Src, STL_HFI_CONGESTION_SETTING_RECORD *Dest) { - Dest->LID = ntoh32(Src->LID); - Dest->reserved = ntoh32(Src->reserved); - memcpy(&(Dest->HFICongestionSetting), &(Src->HFICongestionSetting), sizeof(STL_HFI_CONGESTION_SETTING)); - BSWAP_STL_HFI_CONGESTION_SETTING(&Dest->HFICongestionSetting); -} - /* * HFI Congestion Control Table Record @@ -2070,22 +1402,6 @@ typedef struct { /* all fields are RW */ } PACK_SUFFIX STL_HFI_CONGESTION_CONTROL_TABLE_RECORD; #define HCCTR_COMPONENTMASK_COMP_LID 0x00000001 #define HCCTR_COMPONENTMASK_COMP_BLOCK 0x00000002 -static __inline void -BSWAP_STL_HFI_CONGESTION_CONTROL_TABLE_RECORD(STL_HFI_CONGESTION_CONTROL_TABLE_RECORD *Dest) { - Dest->RID.LID = ntoh32(Dest->RID.LID); - Dest->RID.BlockNum = ntoh16(Dest->RID.BlockNum); - Dest->reserved = ntoh16(Dest->reserved); - BSWAP_STL_HFI_CONGESTION_CONTROL_TABLE(&Dest->HFICongestionControlTable, 1); -} -static __inline void -BSWAPCOPY_STL_HFI_CONGESTION_CONTROL_TABLE_RECORD(STL_HFI_CONGESTION_CONTROL_TABLE_RECORD *Src, STL_HFI_CONGESTION_CONTROL_TABLE_RECORD *Dest) { - Dest->RID.LID = ntoh32(Src->RID.LID); - Dest->RID.BlockNum = ntoh16(Src->RID.BlockNum); - Dest->reserved = ntoh16(Src->reserved); - memcpy(&(Dest->HFICongestionControlTable), &(Src->HFICongestionControlTable), sizeof(STL_HFI_CONGESTION_CONTROL_TABLE)); - BSWAP_STL_HFI_CONGESTION_CONTROL_TABLE(&Dest->HFICongestionControlTable, 1); -} - /* * Buffer Control Table Record @@ -2109,22 +1425,6 @@ typedef struct { #define BFCTRL_COMPONENTMASK_COMP_LID 0x00000001 #define BFCTRL_COMPONENTMASK_COMP_PORT 0x00000002 -static __inline -void -BSWAP_STL_BUFFER_CONTROL_TABLE_RECORD(STL_BUFFER_CONTROL_TABLE_RECORD *Dest) -{ - Dest->RID.LID = ntoh32(Dest->RID.LID); - BSWAP_STL_BUFFER_CONTROL_TABLE(&Dest->BufferControlTable); -} - -static __inline -void -BSWAPCOPY_STL_BUFFER_CONTROL_TABLE_RECORD(STL_BUFFER_CONTROL_TABLE_RECORD *Src, STL_BUFFER_CONTROL_TABLE_RECORD *Dest) -{ - memcpy(Dest, Src, sizeof(STL_BUFFER_CONTROL_TABLE_RECORD)); - BSWAP_STL_BUFFER_CONTROL_TABLE_RECORD(Dest); -} - /* * FabricInfo Record * @@ -2151,28 +1451,25 @@ typedef struct { uint32 rsvd5[92]; } PACK_SUFFIX STL_FABRICINFO_RECORD; -static __inline -void -BSWAP_STL_FABRICINFO_RECORD( - STL_FABRICINFO_RECORD *Dest - ) -{ -#if CPU_LE - Dest->NumHFIs = ntoh32(Dest->NumHFIs); - Dest->NumSwitches = ntoh32(Dest->NumSwitches); - Dest->NumInternalHFILinks = ntoh32(Dest->NumInternalHFILinks); - Dest->NumExternalHFILinks = ntoh32(Dest->NumExternalHFILinks); - Dest->NumInternalISLs = ntoh32(Dest->NumInternalISLs); - Dest->NumExternalISLs = ntoh32(Dest->NumExternalISLs); - Dest->NumDegradedHFILinks = ntoh32(Dest->NumDegradedHFILinks); - Dest->NumDegradedISLs = ntoh32(Dest->NumDegradedISLs); - Dest->NumOmittedHFILinks = ntoh32(Dest->NumOmittedHFILinks); - Dest->NumOmittedISLs = ntoh32(Dest->NumOmittedISLs); -#endif /* CPU_LE */ -} +/* + * SwitchCost Record + */ +#define STL_SWITCH_COST_NUM_ENTRIES 64 +typedef struct _STL_SWITCH_COST { + uint32 DLID; + uint16 value; + uint16 Reserved; +} PACK_SUFFIX STL_SWITCH_COST; + +typedef struct _STL_SWITCH_COST_RECORD { + uint32 SLID; + STL_SWITCH_COST Cost[STL_SWITCH_COST_NUM_ENTRIES]; +} PACK_SUFFIX STL_SWITCH_COST_RECORD; + +#define STL_SWITCH_COST_REC_COMP_SLID 0x0000000000000001ull #if defined (__cplusplus) } #endif -#endif +#endif // __STL_SA_H__ diff --git a/IbAccess/Common/Inc/stl_sd.h b/IbAccess/Common/Inc/stl_sd.h index d5766129..db9a6dbc 100644 --- a/IbAccess/Common/Inc/stl_sd.h +++ b/IbAccess/Common/Inc/stl_sd.h @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT7 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -32,7 +32,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define __STL_SD_H__ #include "iba/ib_sd.h" -#include "iba/stl_sa.h" +#include "iba/stl_sa_types.h" #define NO_STL_MCMEMBER_OUTPUT // Don't output STL McMember Records in SA tools #define NO_STL_SERVICE_OUTPUT // Don't output STL Service Records in SA tools @@ -82,6 +82,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define OutputTypeStlSCSCTableRecord (OutputTypeStlBase+34) #define OutputTypeStlClassPortInfo (OutputTypeStlBase+35) #define OutputTypeStlFabricInfoRecord (OutputTypeStlBase+36) +#define OutputTypeStlSwitchCostRecord (OutputTypeStlBase+53) typedef union _OMGT_QUERY_INPUT_VALUE { @@ -166,6 +167,7 @@ typedef union _OMGT_QUERY_INPUT_VALUE IB_GID McGid; /* InputType */ IB_LID Lid; /* InputType */ uint16 PKey; /* InputType */ + uint8 SL; } IbMcMemberRecord; /* OutputType */ #ifndef NO_STL_MCMEMBER_OUTPUT union _IbMcMemberRecord StlMcMemberRecord; /* OutputType */ @@ -202,6 +204,7 @@ typedef union _OMGT_QUERY_INPUT_VALUE union _LidOnly CableInfoRecord; union _LidOnly PortGroupRecord; union _LidOnly PortGroupFwdRecord; + union _LidOnly SwitchCostRecord; } OMGT_QUERY_INPUT_VALUE; typedef struct _OMGT_QUERY { @@ -374,4 +377,9 @@ typedef struct { STL_PORT_GROUP_FORWARDING_TABLE_RECORD Records[1]; } STL_PORT_GROUP_FORWARDING_TABLE_RECORD_RESULTS, *PSTL_PORT_GROUP_FORWARDING_TABLE_RECORD_RESULTS; +typedef struct { + uint32 NumRecords; + STL_SWITCH_COST_RECORD Records[1]; +} STL_SWITCH_COST_RECORD_RESULTS, *PSTL_SWITCH_COST_RECORD_RESULTS; + #endif diff --git a/IbAccess/Common/Inc/stl_sm_priv.h b/IbAccess/Common/Inc/stl_sm_priv.h new file mode 100644 index 00000000..6a1d97be --- /dev/null +++ b/IbAccess/Common/Inc/stl_sm_priv.h @@ -0,0 +1,928 @@ +/* BEGIN_ICS_COPYRIGHT7 **************************************** + +Copyright (c) 2015-2017, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +** END_ICS_COPYRIGHT7 ****************************************/ + +/* [ICS VERSION STRING: unknown] */ + +#ifndef __IBA_STL_SM_PRIV_H__ +#define __IBA_STL_SM_PRIV_H__ + +#include "iba/stl_types.h" +#include "iba/ib_sm_priv.h" +#include "iba/stl_sm_types.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +static __inline void +BSWAP_STL_TRAP_CHANGE_CAPABILITY_DATA(STL_TRAP_CHANGE_CAPABILITY_DATA *Src) +{ +#if CPU_LE + Src->Lid = ntoh32(Src->Lid); + Src->CapabilityMask.AsReg32 = ntoh32(Src->CapabilityMask.AsReg32); + Src->CapabilityMask3.AsReg16 = ntoh16(Src->CapabilityMask3.AsReg16); + Src->u.AsReg16 = ntoh16(Src->u.AsReg16); +#endif +} + +static __inline void +BSWAPCOPY_STL_TRAP_CHANGE_CAPABILITY_DATA(STL_TRAP_CHANGE_CAPABILITY_DATA *Src, + STL_TRAP_CHANGE_CAPABILITY_DATA *Dest) +{ + memcpy(Dest, Src, sizeof(STL_TRAP_CHANGE_CAPABILITY_DATA)); + BSWAP_STL_TRAP_CHANGE_CAPABILITY_DATA(Dest); +} + +static __inline void +BSWAP_STL_TRAP_BAD_KEY_DATA(STL_TRAP_BAD_KEY_DATA *Src) +{ +#if CPU_LE + uint64_t temp; + + Src->Lid1 = ntoh32(Src->Lid1); + Src->Lid2 = ntoh32(Src->Lid2); + Src->Key = ntoh32(Src->Key); + // u + // Reserved[3] + temp = ntoh64(Src->Gid1.AsReg64s.H); + Src->Gid1.AsReg64s.H = ntoh64(Src->Gid1.AsReg64s.L); + Src->Gid1.AsReg64s.L = temp; + temp = ntoh64(Src->Gid2.AsReg64s.H); + Src->Gid2.AsReg64s.H = ntoh64(Src->Gid2.AsReg64s.L); + Src->Gid2.AsReg64s.L = temp; + Src->qp1.AsReg32= ntoh32(Src->qp1.AsReg32); + Src->qp2.AsReg32= ntoh32(Src->qp2.AsReg32); +#endif +} + +static __inline void +BSWAPCOPY_STL_TRAP_BAD_KEY_DATA(STL_TRAP_BAD_KEY_DATA *Src, STL_TRAP_BAD_KEY_DATA *Dest) +{ + memcpy(Dest, Src, sizeof(STL_TRAP_BAD_KEY_DATA)); + BSWAP_STL_TRAP_BAD_KEY_DATA(Dest); +} + +static __inline void +BSWAP_STL_AGGREGATE_HEADER(STL_AGGREGATE *Dest) +{ +#if CPU_LE + Dest->AttributeID = ntoh16(Dest->AttributeID); + Dest->Result.AsReg16 = ntoh16(Dest->Result.AsReg16); + Dest->AttributeModifier = ntoh32(Dest->AttributeModifier); +#endif +} + +static __inline void +ZERO_RSVD_STL_AGGREGATE(STL_AGGREGATE *Dest) +{ + Dest->Result.s.Reserved = 0; +} + +/** + Zero & swap or swap & zero @c segCount segment headers in range [start, end) for network transport. + Stops swapping response on first error segment. When going from host to network order, + stops before swapping segment header to network order if segment header error flag is set. + + Stops when either: next segment is past @c end; @c *segCount segments have been processed; or @c seg->Result.s.Error is not zero. + + @param segCount [in, out] As input, number of segments in [start, end). As output, number of segments processed. + @param hton When true, swap host to network order, otherwise network to host. + + @return Pointer past the last good segment processed (also pointer to first bad segment in case of error). +*/ +static __inline STL_AGGREGATE * +BSWAP_ZERO_AGGREGATE_HEADERS(STL_AGGREGATE * start, STL_AGGREGATE * end, int * segCount, boolean hton) +{ + int count = 0; + STL_AGGREGATE * h = start; + + while (h < end && count < *segCount) { + if (hton) { + if (h->Result.s.Error) + break; + ZERO_RSVD_STL_AGGREGATE(h); + STL_AGGREGATE * next = STL_AGGREGATE_NEXT(h); + BSWAP_STL_AGGREGATE_HEADER(h); + h = next; + } + else { + BSWAP_STL_AGGREGATE_HEADER(h); + ZERO_RSVD_STL_AGGREGATE(h); + if (h->Result.s.Error) + break; + h = STL_AGGREGATE_NEXT(h); + } + ++count; + } + + *segCount = count; + return h; +} + +static __inline void +BSWAP_STL_DR_SMP(DRStlSmp_t *Dest) +{ +#if CPU_LE + Dest->M_Key = ntoh64(Dest->M_Key); + Dest->DrSLID = ntoh32(Dest->DrSLID); + Dest->DrDLID = ntoh32(Dest->DrDLID); +#endif +} + +static __inline void +BSWAPCOPY_STL_DR_SMP(DRStlSmp_t *Src, DRStlSmp_t *Dest) +{ + memcpy(Dest, Src, sizeof(DRStlSmp_t)); + (void)BSWAP_STL_DR_SMP(Dest); +} + +#define DRStlMad_Init(MAIP,METHOD,TID,AID,AMOD,MKEY,IPATH) { \ + DRStlSmp_t *drp; \ + \ + (void)memset((void *)&(MAIP)->base, 0, sizeof((MAIP)->base)); \ + \ + (MAIP)->active |= (MAI_ACT_BASE | MAI_ACT_DATA); \ + (MAIP)->base.bversion = STL_BASE_VERSION; \ + (MAIP)->base.mclass = MAD_CV_SUBN_DR; \ + (MAIP)->base.cversion = STL_SM_CLASS_VERSION; \ + (MAIP)->base.method = METHOD; \ + (MAIP)->base.status = 0; \ + (MAIP)->base.hopPointer = 0; \ + (MAIP)->base.hopCount = IPATH[0]; \ + (MAIP)->base.tid = TID; \ + (MAIP)->base.aid = AID; \ + (MAIP)->base.rsvd3 = 0; \ + (MAIP)->base.amod = AMOD; \ + \ + drp = (DRStlSmp_t *)(MAIP)->data; \ + (void)memset((void *)drp, 0, sizeof(*drp)); \ + \ + drp->M_Key = MKEY; \ + drp->DrSLID = STL_LID_PERMISSIVE; \ + drp->DrDLID = STL_LID_PERMISSIVE; \ + \ + (void)memcpy((void *)&drp->InitPath[1], (void *)&IPATH[1], IPATH[0]); \ +} + +#define LRDRStlMad_Init(MAIP,METHOD,TID,AID,AMOD,MKEY,IPATH,SLID) { \ + DRStlSmp_t *drp; \ + \ + (void)memset((void *)&(MAIP)->base, 0, sizeof((MAIP)->base)); \ + \ + (MAIP)->active |= (MAI_ACT_BASE | MAI_ACT_DATA); \ + (MAIP)->base.bversion = STL_BASE_VERSION; \ + (MAIP)->base.mclass = MAD_CV_SUBN_DR; \ + (MAIP)->base.cversion = STL_SM_CLASS_VERSION; \ + (MAIP)->base.method = METHOD; \ + (MAIP)->base.status = 0; \ + (MAIP)->base.hopPointer = 0; \ + (MAIP)->base.hopCount = IPATH[0]; \ + (MAIP)->base.tid = TID; \ + (MAIP)->base.aid = AID; \ + (MAIP)->base.rsvd3 = 0; \ + (MAIP)->base.amod = AMOD; \ + \ + drp = (DRStlSmp_t *)(MAIP)->data; \ + (void)memset((void *)drp, 0, sizeof(*drp)); \ + drp->M_Key = MKEY; \ + drp->DrSLID = SLID; \ + drp->DrDLID = STL_LID_PERMISSIVE; \ + \ + (void)memcpy((void *)&drp->InitPath[1], (void *)&IPATH[1], IPATH[0]); \ +} + +#define LRStlMad_Init(MAIP,MCLASS,METHOD,TID,AID,AMOD,MKEY) { \ + LRStlSmp_t *lrp; \ + \ + (void)memset((void *)&(MAIP)->base, 0, sizeof((MAIP)->base)); \ + \ + (MAIP)->active |= (MAI_ACT_BASE | MAI_ACT_DATA); \ + (MAIP)->base.bversion = STL_BASE_VERSION; \ + (MAIP)->base.mclass = MCLASS; \ + (MAIP)->base.cversion = MCLASS == MAD_CV_SUBN_ADM ? SA_MAD_CVERSION : STL_SM_CLASS_VERSION; \ + (MAIP)->base.method = METHOD; \ + (MAIP)->base.status = 0; \ + (MAIP)->base.hopPointer = 0; \ + (MAIP)->base.hopCount = 0; \ + (MAIP)->base.tid = TID; \ + (MAIP)->base.aid = AID; \ + (MAIP)->base.rsvd3 = 0; \ + (MAIP)->base.amod = AMOD; \ + \ + lrp = (LRStlSmp_t *)(MAIP)->data; \ + (void)memset((void *)lrp, 0, sizeof(*lrp)); \ + \ + lrp->M_Key = MKEY; \ +} + +// USER ADVICE: Be careful with casting and using the macros below: +// There exist two versions of stl_get_smp_data: +// 1: Uses Mai_t* input parameter to be used with MAI API (FM only). +// 2: Uses STL_SMP* input parameter to be used with tools. +#define STL_GET_SMP_DATA(MAIP) ((maip->base.mclass == MAD_CV_SUBN_DR) ? \ + ((DRStlSmp_t *)(maip->data))->SMPData : ((LRStlSmp_t *)(maip->data))->SMPData) + +#define STL_GET_MAI_KEY(MAIP) ((maip->base.mclass == MAD_CV_SUBN_DR) ? \ + &(((DRStlSmp_t *)(maip->data))->M_Key) : &(((LRStlSmp_t *)(maip->data))->M_Key)) + +static inline uint8_t *stl_get_smp_data(STL_SMP *smp) +{ + if (smp->common.MgmtClass == MCLASS_SM_DIRECTED_ROUTE) { + return smp->SmpExt.DirectedRoute.SMPData; + } + return smp->SmpExt.LIDRouted.SMPData; +} + +static inline size_t stl_get_smp_data_size(STL_SMP *smp) +{ + if (smp->common.MgmtClass == MCLASS_SM_DIRECTED_ROUTE) { + return STL_MAX_PAYLOAD_SMP_DR; + } + return STL_MAX_PAYLOAD_SMP_LR; +} + +static inline size_t stl_get_smp_header_size(STL_SMP * smp) +{ + return sizeof(STL_SMP) - stl_get_smp_data_size(smp); +} + +static __inline uint8 +GET_STL_PORT_INFO_NeighborMTU(const STL_PORT_INFO *PortInfo, uint8 vl) { + if (vl & 0x01) + return(PortInfo->NeighborMTU[(vl & 0x1F) / 2].s.VL1_to_MTU); + else + return(PortInfo->NeighborMTU[(vl & 0x1F) / 2].s.VL0_to_MTU); +} + +static __inline void +PUT_STL_PORT_INFO_NeighborMTU(STL_PORT_INFO *PortInfo, uint8 vl, uint8 mtu) { + if (vl & 0x01) + PortInfo->NeighborMTU[(vl & 0x1F) / 2].s.VL1_to_MTU = mtu & 0x0F; + else + PortInfo->NeighborMTU[(vl & 0x1F) / 2].s.VL0_to_MTU = mtu & 0x0F; +} + +/* Is the Smp given from a local requestor (eg. on the same host such as a + * smp from IbAccess to its own local port or from a local SM) + * allow HopPointer to be 0 for direct use of GetSetMad and + * 1 for packets which passed through SMI prior to GetSetMad + */ +static __inline boolean +STL_SMP_IS_LOCAL(STL_SMP *Smp) +{ + return (( MCLASS_SM_DIRECTED_ROUTE == Smp->common.MgmtClass ) && + ( Smp->common.u.DR.HopPointer == 0 + || Smp->common.u.DR.HopPointer == 1) && + ( Smp->common.u.DR.HopCount == 0 )); +} + +static __inline void +STL_SMP_SET_LOCAL(STL_SMP *Smp) +{ + Smp->common.MgmtClass = MCLASS_SM_DIRECTED_ROUTE; + Smp->common.u.DR.HopPointer = 0; + Smp->common.u.DR.HopCount = 0; + Smp->SmpExt.DirectedRoute.DrSLID = STL_LID_PERMISSIVE; + Smp->SmpExt.DirectedRoute.DrDLID = STL_LID_PERMISSIVE; +} + +static __inline void +BSWAP_STL_SMP_HEADER(STL_SMP *Dest) +{ +#if CPU_LE + BSWAP_MAD_HEADER((MAD *)Dest); + + Dest->M_Key = ntoh64(Dest->M_Key); + if (Dest->common.MgmtClass == MCLASS_SM_DIRECTED_ROUTE) { + Dest->SmpExt.DirectedRoute.DrSLID = \ + ntoh32(Dest->SmpExt.DirectedRoute.DrSLID); + Dest->SmpExt.DirectedRoute.DrDLID = \ + ntoh32(Dest->SmpExt.DirectedRoute.DrDLID); + } +#endif +} + +static __inline void +BSWAPCOPY_STL_SMP(STL_SMP *Src, STL_SMP *Dest) +{ + memcpy(Dest, Src, sizeof(STL_SMP)); + (void)BSWAP_STL_SMP_HEADER(Dest); +} + +#define STL_BSWAP_SMP_HEADER BSWAP_STL_SMP_HEADER /* Temporary definition */ + + +static __inline void +BSWAP_STL_TRAP_PORT_CHANGE_STATE_DATA(STL_TRAP_PORT_CHANGE_STATE_DATA * data) +{ +#if CPU_LE + data->Lid = ntoh32(data->Lid); +#endif +} + +static __inline void +BSWAP_STL_SMA_TRAP_DATA_LINK_WIDTH(STL_SMA_TRAP_DATA_LINK_WIDTH *Dest) +{ +#if CPU_LE + Dest->ReportingLID = ntoh32(Dest->ReportingLID); +#endif +} + + +static __inline void +BSWAP_STL_NODE_DESCRIPTION(STL_NODE_DESCRIPTION *Dest) +{ +#if CPU_LE + /* pure text field, nothing to swap */ +#endif +} + + +static __inline void +BSWAP_STL_NODE_INFO(STL_NODE_INFO *Dest) +{ +#if CPU_LE + Dest->SystemImageGUID = ntoh64(Dest->SystemImageGUID ); + Dest->NodeGUID = ntoh64(Dest->NodeGUID); + Dest->PortGUID = ntoh64(Dest->PortGUID); + Dest->PartitionCap = ntoh16(Dest->PartitionCap); + Dest->DeviceID = ntoh16(Dest->DeviceID); + Dest->Revision = ntoh32(Dest->Revision); + Dest->u1.AsReg32 = ntoh32(Dest->u1.AsReg32); +#endif +} + + +/* NOTE: for this implementation the cost of checking for and handling + * overlapping memory regions is assumed to be higher than warranted. + */ +static __inline void +BSWAPCOPY_STL_NODE_INFO(STL_NODE_INFO *Src, STL_NODE_INFO *Dest) +{ +if (Src != Dest) + (void)memcpy((void *)Dest, (void *)Src, sizeof(STL_NODE_INFO)); + BSWAP_STL_NODE_INFO(Dest); +} + + +static __inline void +BSWAP_STL_SWITCH_INFO(STL_SWITCH_INFO *Dest) +{ +#if CPU_LE + Dest->LinearFDBCap = ntoh32(Dest->LinearFDBCap); + Dest->PortGroupFDBCap = ntoh32(Dest->PortGroupFDBCap); + Dest->MulticastFDBCap = ntoh32(Dest->MulticastFDBCap); + Dest->LinearFDBTop = ntoh32(Dest->LinearFDBTop); + Dest->MulticastFDBTop = ntoh32(Dest->MulticastFDBTop); + Dest->CollectiveCap = ntoh32(Dest->CollectiveCap); + Dest->CollectiveTop = ntoh32(Dest->CollectiveTop); + Dest->PartitionEnforcementCap = ntoh16(Dest->PartitionEnforcementCap); + Dest->AdaptiveRouting.AsReg16 = ntoh16(Dest->AdaptiveRouting.AsReg16); + Dest->CapabilityMask.AsReg16 = ntoh16(Dest->CapabilityMask.AsReg16); + Dest->CapabilityMaskCollectives.AsReg16 = ntoh16(Dest->CapabilityMaskCollectives.AsReg16); +#endif +} + +static __inline void +ZERO_RSVD_STL_SWITCH_INFO(STL_SWITCH_INFO * Dest) +{ + Dest->Reserved = 0; + Dest->Reserved21 = 0; + Dest->Reserved22 = 0; + Dest->Reserved23 = 0; + + Dest->Reserved24 = 0; + + Dest->u2.s.Reserved20 = 0; + Dest->u2.s.Reserved21 = 0; + Dest->u2.s.Reserved22 = 0; + Dest->u2.s.Reserved23 = 0; + Dest->u2.s.Reserved = 0; + + Dest->MultiCollectMask.Reserved = 0; + Dest->AdaptiveRouting.s.Reserved = 0; +} + +static __inline void +BSWAPCOPY_STL_SWITCH_INFO(STL_SWITCH_INFO *Src, STL_SWITCH_INFO *Dest) +{ + if (Src != Dest) memcpy((void *)Dest, (void *)Src, sizeof(STL_SWITCH_INFO)); + BSWAP_STL_SWITCH_INFO(Dest); +} + +static __inline void +BSWAP_STL_MKEY(uint64_t *mkey) +{ +#if CPU_LE + *mkey = ntoh64(*mkey); +#endif +} + +static __inline void +BSWAPCOPY_STL_MKEY(uint64_t *Src, uint64_t *Dest) +{ + if (Src != Dest) memcpy((void *)Dest, (void *)Src, sizeof(uint64_t)); + BSWAP_STL_MKEY(Dest); +} + +static __inline void +BSWAP_STL_PORT_INFO(STL_PORT_INFO *Dest) +{ +#if CPU_LE + Dest->LID = ntoh32(Dest->LID); + Dest->FlowControlMask = ntoh32(Dest->FlowControlMask); + Dest->VL.HighLimit = ntoh16(Dest->VL.HighLimit); + Dest->VL.PreemptingLimit = ntoh16(Dest->VL.PreemptingLimit); + Dest->PortStates.AsReg32 = ntoh32(Dest->PortStates.AsReg32); + Dest->P_Keys.P_Key_8B = ntoh16(Dest->P_Keys.P_Key_8B); + Dest->P_Keys.P_Key_10B = ntoh16(Dest->P_Keys.P_Key_10B); + Dest->Violations.M_Key = ntoh16(Dest->Violations.M_Key); + Dest->Violations.P_Key = ntoh16(Dest->Violations.P_Key); + Dest->Violations.Q_Key = ntoh16(Dest->Violations.Q_Key); + Dest->SM_TrapQP.AsReg32 = ntoh32(Dest->SM_TrapQP.AsReg32); + Dest->SA_QP.AsReg32 = ntoh32(Dest->SA_QP.AsReg32); + Dest->LinkSpeed.Supported = ntoh16(Dest->LinkSpeed.Supported); + Dest->LinkSpeed.Enabled = ntoh16(Dest->LinkSpeed.Enabled); + Dest->LinkSpeed.Active = ntoh16(Dest->LinkSpeed.Active); + Dest->LinkWidth.Supported = ntoh16(Dest->LinkWidth.Supported); + Dest->LinkWidth.Enabled = ntoh16(Dest->LinkWidth.Enabled); + Dest->LinkWidth.Active = ntoh16(Dest->LinkWidth.Active); + Dest->LinkWidthDowngrade.Supported = ntoh16(Dest->LinkWidthDowngrade.Supported); + Dest->LinkWidthDowngrade.Enabled = ntoh16(Dest->LinkWidthDowngrade.Enabled); + Dest->LinkWidthDowngrade.TxActive = ntoh16(Dest->LinkWidthDowngrade.TxActive); + Dest->LinkWidthDowngrade.RxActive = ntoh16(Dest->LinkWidthDowngrade.RxActive); + Dest->PortLinkMode.AsReg16 = ntoh16(Dest->PortLinkMode.AsReg16); + Dest->PortLTPCRCMode.AsReg16 = ntoh16(Dest->PortLTPCRCMode.AsReg16); + Dest->PortMode.AsReg16 = ntoh16(Dest->PortMode.AsReg16); + Dest->PortPacketFormats.Supported = ntoh16(Dest->PortPacketFormats.Supported); + Dest->PortPacketFormats.Enabled = ntoh16(Dest->PortPacketFormats.Enabled); + Dest->FlitControl.Interleave.AsReg16 = ntoh16(Dest->FlitControl.Interleave.AsReg16); + Dest->FlitControl.Preemption.MinInitial = ntoh16(Dest->FlitControl.Preemption.MinInitial); + Dest->FlitControl.Preemption.MinTail = ntoh16(Dest->FlitControl.Preemption.MinTail); + Dest->PortErrorAction.AsReg32 = ntoh32(Dest->PortErrorAction.AsReg32); + Dest->M_KeyLeasePeriod = ntoh16(Dest->M_KeyLeasePeriod); + Dest->BufferUnits.AsReg32 = ntoh32(Dest->BufferUnits.AsReg32); + Dest->MasterSMLID = ntoh32(Dest->MasterSMLID); + Dest->M_Key = ntoh64(Dest->M_Key); + Dest->SubnetPrefix = ntoh64(Dest->SubnetPrefix); + Dest->NeighborNodeGUID = ntoh64(Dest->NeighborNodeGUID); + Dest->CapabilityMask.AsReg32 = ntoh32(Dest->CapabilityMask.AsReg32); + Dest->CapabilityMask3.AsReg16 = ntoh16(Dest->CapabilityMask3.AsReg16); + Dest->OverallBufferSpace = ntoh16(Dest->OverallBufferSpace); + Dest->DiagCode.AsReg16 = ntoh16(Dest->DiagCode.AsReg16); +#endif +} + +static __inline void +ZERO_RSVD_STL_PORT_INFO(STL_PORT_INFO * Dest) +{ + Dest->VL.s2.Reserved = 0; + Dest->PortStates.s.Reserved = 0; + Dest->PortPhysConfig.s.Reserved = 0; + Dest->MultiCollectMask.Reserved = 0; + Dest->s1.Reserved = 0; + Dest->s3.Reserved20 = 0; + Dest->s3.Reserved21 = 0; + Dest->s4.Reserved = 0; + Dest->SM_TrapQP.s.Reserved = 0; + Dest->SA_QP.s.Reserved = 0; + Dest->PortLinkMode.s.Reserved = 0; + Dest->PortLTPCRCMode.s.Reserved = 0; + Dest->PortMode.s.Reserved = 0; + Dest->PortMode.s.Reserved2 = 0; + Dest->PortMode.s.Reserved3 = 0; + Dest->FlitControl.Interleave.s.Reserved = 0; + Dest->Reserved13 = 0; + Dest->PortErrorAction.s.Reserved = 0; + Dest->PortErrorAction.s.Reserved2 = 0; + Dest->PortErrorAction.s.Reserved3 = 0; + Dest->PortErrorAction.s.Reserved4 = 0; + Dest->PassThroughControl.Reserved = 0; + Dest->BufferUnits.s.Reserved = 0; + Dest->Reserved14 = 0; + // Reserved fields in the RO section + Dest->Reserved20 = 0; + Dest->CapabilityMask.s.CmReserved6 = 0; + Dest->CapabilityMask.s.CmReserved24 = 0; + Dest->CapabilityMask.s.CmReserved5 = 0; + Dest->CapabilityMask.s.CmReserved23 = 0; + Dest->CapabilityMask.s.CmReserved22 = 0; + Dest->CapabilityMask.s.CmReserved21 = 0; + Dest->CapabilityMask.s.CmReserved25 = 0; + Dest->CapabilityMask.s.CmReserved2 = 0; + Dest->CapabilityMask.s.CmReserved20 = 0; + Dest->CapabilityMask.s.CmReserved1 = 0; + Dest->Reserved20 = 0; + Dest->CapabilityMask3.s.CmReserved = 0; + Dest->Reserved23 = 0; + Dest->Reserved21 = 0; + Dest->PortNeighborMode.Reserved = 0; + Dest->MTU.Reserved20 = 0; + Dest->Resp.Reserved = 0; + Dest->Reserved24 = 0; +} + +static __inline void +BSWAP_STL_PARTITION_TABLE(STL_PARTITION_TABLE *Dest) +{ +#if CPU_LE + uint32 i; + + for (i = 0; i < NUM_PKEY_ELEMENTS_BLOCK; i++) + { + Dest->PartitionTableBlock[i].AsReg16 = \ + ntoh16(Dest->PartitionTableBlock[i].AsReg16); + } +#endif +} + +static __inline void +BSWAPCOPY_STL_PARTITION_TABLE(STL_PARTITION_TABLE *Src, STL_PARTITION_TABLE *Dest) +{ + if (Src != Dest) memcpy(Dest, Src, sizeof(STL_PARTITION_TABLE)); + BSWAP_STL_PARTITION_TABLE(Dest); +} + + +static __inline void +BSWAP_STL_SLSCMAP(STL_SLSCMAP *Dest) +{ +#if CPU_LE + /* nothing to swap */ +#endif +} + +static __inline void +ZERO_RSVD_STL_SLSCMAP(STL_SLSCMAP * Dest) +{ + uint32 i; + for (i = 0; i < sizeof(Dest->SLSCMap)/sizeof(Dest->SLSCMap[0]); ++i) { + Dest->SLSCMap[i].Reserved = 0; + } +} + +static __inline void +BSWAP_STL_SCSCMAP(STL_SCSCMAP *Dest) +{ +#if CPU_LE + /* nothing to swap */ +#endif +} + + +static __inline void +BSWAP_STL_SCSLMAP(STL_SCSLMAP *Dest) +{ +#if CPU_LE + /* nothing to swap */ +#endif +} + +static __inline void +ZERO_RSVD_STL_SCSLMAP(STL_SCSLMAP *Dest) +{ + uint32 i; + for (i = 0; i < sizeof(Dest->SCSLMap)/sizeof(Dest->SCSLMap[0]); ++i) { + Dest->SCSLMap[i].Reserved = 0; + } +} + +static __inline void +BSWAP_STL_SCVLMAP(STL_SCVLMAP *Dest) +{ +#if CPU_LE + /* nothing to swap */ +#endif +} + +static __inline void +ZERO_RSVD_STL_SCVLMAP(STL_SCVLMAP *Dest) +{ + uint32 i; + for (i = 0; i < sizeof(Dest->SCVLMap)/sizeof(Dest->SCVLMap[0]); ++i) { + Dest->SCVLMap[i].Reserved = 0; + } +} + +/* The section flag refers to which section of STL_VLARB_TABLE + * is to be swapped (see STL_VLARB_TABLE). Only the Preemption + * Matrix section (STL_VLARB_PREEMPT_MATRIX) requires action. + */ +static __inline void +BSWAP_STL_VLARB_TABLE(STL_VLARB_TABLE *Dest, int section) +{ +#if CPU_LE + uint32 i; + + if (section == STL_VLARB_PREEMPT_MATRIX) + { + for (i = 0; i < STL_MAX_VLS; i++) + Dest->Matrix[i] = ntoh32(Dest->Matrix[i]); + } +#endif +} + +static __inline void +ZERO_RSVD_STL_VLARB_TABLE(STL_VLARB_TABLE *Dest, uint8 section) +{ + if (section != STL_VLARB_PREEMPT_MATRIX) { + uint32 i; + for (i = 0; i < VLARB_TABLE_LENGTH; ++i) + Dest->Elements[i].s.Reserved = 0; + } +} + +static __inline void +BSWAP_STL_LINEAR_FORWARDING_TABLE(STL_LINEAR_FORWARDING_TABLE *Dest) +{ +#if CPU_LE + /* nothing to swap */ +#endif +} + + +static __inline void +BSWAP_STL_MULTICAST_FORWARDING_TABLE(STL_MULTICAST_FORWARDING_TABLE *Dest) +{ +#if CPU_LE + uint32 i; + + for (i = 0; i < STL_NUM_MFT_ELEMENTS_BLOCK; i++) + { + Dest->MftBlock[i] = ntoh64(Dest->MftBlock[i]); + } +#endif +} + +static __inline void +BSWAP_STL_SM_INFO(STL_SM_INFO *Dest) +{ +#if CPU_LE + Dest->PortGUID = ntoh64(Dest->PortGUID); + Dest->SM_Key = ntoh64(Dest->SM_Key); + Dest->ActCount = ntoh32(Dest->ActCount); + Dest->ElapsedTime = ntoh32(Dest->ElapsedTime); + Dest->u.AsReg16 = ntoh16(Dest->u.AsReg16); +#endif +} + +static __inline void +BSWAPCOPY_STL_SM_INFO(STL_SM_INFO *Src, STL_SM_INFO *Dest) +{ + memcpy(Dest, Src, sizeof(STL_SM_INFO)); + BSWAP_STL_SM_INFO(Dest); +} + +static __inline const char* +StlSMStateToText(SM_STATE state) +{ + return ((state == SM_INACTIVE)? "Inactive": + (state == SM_DISCOVERING)? "Discovering": + (state == SM_STANDBY)? "Standby": + (state == SM_MASTER)? "Master": "???"); +} + +static __inline void +BSWAP_STL_LED_INFO(STL_LED_INFO *Dest) +{ +#if CPU_LE + Dest->u.AsReg32 = ntoh32(Dest->u.AsReg32); +#endif +} + +static __inline void +ZERO_RSVD_STL_LED_INFO(STL_LED_INFO *Dest) { + + Dest->Reserved2 = 0; + +} + + +static __inline void +BSWAP_STL_CABLE_INFO(STL_CABLE_INFO *Dest) +{ +#if CPU_LE + /* nothing to swap */ +#endif +} + + +static __inline void +BSWAP_STL_AGGREGATE(STL_AGGREGATE *Dest) +{ +#if CPU_LE + Dest->AttributeID = ntoh16(Dest->AttributeID); + Dest->Result.AsReg16 = ntoh16(Dest->Result.AsReg16); + Dest->AttributeModifier = ntoh32(Dest->AttributeModifier); +#endif +} + + +/* num_ports is the number of port entries in STL_PORT_STATE_INFO */ +static __inline void +BSWAP_STL_PORT_STATE_INFO(STL_PORT_STATE_INFO *Dest, uint8 num_ports) +{ +#if CPU_LE + uint32 i; + + for (i = 0; i < num_ports; i++) + { + Dest[i].PortStates.AsReg32 = ntoh32(Dest[i].PortStates.AsReg32); + Dest[i].LinkWidthDowngradeTxActive = ntoh16(Dest[i].LinkWidthDowngradeTxActive); + Dest[i].LinkWidthDowngradeRxActive = ntoh16(Dest[i].LinkWidthDowngradeRxActive); + } +#endif +} + + +static __inline void +BSWAP_STL_PORT_GROUP_FORWARDING_TABLE(STL_PORT_GROUP_FORWARDING_TABLE *Dest) +{ +#if CPU_LE + /* nothing to swap */ +#endif +} + + +static __inline void +BSWAP_STL_PORT_GROUP_TABLE(STL_PORT_GROUP_TABLE *Dest) +{ +#if CPU_LE + uint32 i; + + for (i = 0; i < NUM_PGT_ELEMENTS_BLOCK; i++) + { + Dest->PgtBlock[i] = ntoh64(Dest->PgtBlock[i]); + } +#endif +} + + +static __inline void +BSWAP_STL_BUFFER_CONTROL_TABLE(STL_BUFFER_CONTROL_TABLE *Dest) +{ +#if CPU_LE + uint32 i; + + Dest->TxOverallSharedLimit = ntoh16(Dest->TxOverallSharedLimit); + + for (i = 0; i < STL_MAX_VLS; i++) + { + Dest->VL[i].TxDedicatedLimit = ntoh16(Dest->VL[i].TxDedicatedLimit); + Dest->VL[i].TxSharedLimit = ntoh16(Dest->VL[i].TxSharedLimit); + } +#endif +} + + +static __inline void +BSWAP_STL_CONGESTION_INFO(STL_CONGESTION_INFO *Dest) +{ +#if CPU_LE + Dest->CongestionInfo = ntoh16(Dest->CongestionInfo); +#endif +} + + +/* num_blocks is the number of blocks in STL_SWITCH_CONGESTION_LOG to swap */ +static __inline void +BSWAP_STL_SWITCH_CONGESTION_LOG(STL_SWITCH_CONGESTION_LOG *Dest) +{ +#if CPU_LE + uint32 i; + + Dest->LogEventsCounter = ntoh16(Dest->LogEventsCounter); + Dest->CurrentTimeStamp = ntoh32(Dest->CurrentTimeStamp); + + for (i = 0; i < STL_NUM_CONGESTION_LOG_ELEMENTS; i++) + { + Dest->CongestionEntryList[i].SLID = ntoh32(Dest->CongestionEntryList[i].SLID); + Dest->CongestionEntryList[i].DLID = ntoh32(Dest->CongestionEntryList[i].DLID); + Dest->CongestionEntryList[i].TimeStamp = ntoh32(Dest->CongestionEntryList[i].TimeStamp); + } +#endif +} + + +static __inline void +BSWAP_STL_SWITCH_CONGESTION_SETTING(STL_SWITCH_CONGESTION_SETTING *Dest) +{ +#if CPU_LE + Dest->Control_Map = ntoh32(Dest->Control_Map); + Dest->CS_ReturnDelay = ntoh16(Dest->CS_ReturnDelay); + Dest->Marking_Rate = ntoh16(Dest->Marking_Rate); +#endif +} + +static __inline void +ZERO_RSVD_STL_SWITCH_CONGESTION_SETTING(STL_SWITCH_CONGESTION_SETTING *Dest) +{ + Dest->Reserved = 0; + Dest->Reserved2 = 0; + Dest->Reserved3 = 0; +} + +/* num_ports is the number of ports in STL_SWITCH_PORT_CONGESTION_SETTING to swap */ +static __inline void +BSWAP_STL_SWITCH_PORT_CONGESTION_SETTING(STL_SWITCH_PORT_CONGESTION_SETTING *Dest, uint8 num_ports) +{ +#if CPU_LE + uint32 i; + + for (i = 0; i < num_ports; i++) + { + Dest->Elements[i].Marking_Rate = ntoh16(Dest->Elements[i].Marking_Rate); + } +#endif +} + + +/* num_blocks is the number of blocks in STL_HFI_CONGESTION_LOG to swap */ +static __inline void +BSWAP_STL_HFI_CONGESTION_LOG(STL_HFI_CONGESTION_LOG *Dest) +{ +#if CPU_LE + uint32 i; + + Dest->ThresholdEventCounter = ntoh16(Dest->ThresholdEventCounter); + Dest->CurrentTimeStamp = ntoh16(Dest->CurrentTimeStamp); + + for (i = 0; i < STL_NUM_CONGESTION_LOG_ELEMENTS; i++) + { + Dest->CongestionEntryList[i].Remote_LID_CN_Entry = + ntoh32(Dest->CongestionEntryList[i].Remote_LID_CN_Entry); + Dest->CongestionEntryList[i].TimeStamp_CN_Entry = + ntoh32(Dest->CongestionEntryList[i].TimeStamp_CN_Entry); + } +#endif +} + + +static __inline void +BSWAP_STL_HFI_CONGESTION_SETTING(STL_HFI_CONGESTION_SETTING *Dest) +{ +#if CPU_LE + uint32 i; + + Dest->Port_Control = ntoh16(Dest->Port_Control); + Dest->Control_Map = ntoh32(Dest->Control_Map); + + for (i = 0; i < STL_MAX_SLS; i++) + { + Dest->HFICongestionEntryList[i].CCTI_Timer = + ntoh16(Dest->HFICongestionEntryList[i].CCTI_Timer); + } +#endif +} + + +/* num_blocks is the number of blocks in STL_HFI_CONGESTION_CONTROL_TABLE to swap */ +static __inline void +BSWAP_STL_HFI_CONGESTION_CONTROL_TABLE(STL_HFI_CONGESTION_CONTROL_TABLE *Dest, uint8 num_blocks) +{ +#if CPU_LE + uint32 i,j; + + Dest->CCTI_Limit = ntoh16(Dest->CCTI_Limit); + + for(i = 0; i < num_blocks; ++i) { + for (j = 0; j < STL_NUM_CONGESTION_CONTROL_ELEMENTS_BLOCK_ENTRIES; ++j) { + Dest->CCT_Block_List[i].CCT_Entry_List[j].AsReg16 = + ntoh16(Dest->CCT_Block_List[i].CCT_Entry_List[j].AsReg16); + } + } +#endif +} + + +#if defined (__cplusplus) +}; +#endif + +#endif /* __IBA_STL_SM_PRIV_H__ */ diff --git a/IbAccess/Common/Inc/stl_sm.h b/IbAccess/Common/Inc/stl_sm_types.h similarity index 73% rename from IbAccess/Common/Inc/stl_sm.h rename to IbAccess/Common/Inc/stl_sm_types.h index c69b538b..d6f08e8c 100644 --- a/IbAccess/Common/Inc/stl_sm.h +++ b/IbAccess/Common/Inc/stl_sm_types.h @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT7 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -29,11 +29,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* [ICS VERSION STRING: unknown] */ -#ifndef __IBA_STL_SM_H__ -#define __IBA_STL_SM_H__ +#ifndef __IBA_STL_SM_TYPES_H__ +#define __IBA_STL_SM_TYPES_H__ -#include "iba/ib_sm.h" #include "iba/stl_types.h" +#include "iba/ib_sm_types.h" #if defined (__cplusplus) extern "C" { @@ -59,9 +59,9 @@ extern "C" { #define STL_MCLASS_ATTRIB_ID_LINEAR_FWD_TABLE 0x0019 /* Linear Forwarding Table */ // reserved 0x001A /* (was) Random Forwarding Table */ #define STL_MCLASS_ATTRIB_ID_MCAST_FWD_TABLE 0x001B /* Multicast Forwarding Table */ -#define STL_MCLASS_ATTRIB_ID_SM_INFO 0x0020 /* Subnet Manager Information */ -#define STL_MCLASS_ATTRIB_ID_LED_INFO 0x0031 /* Turn on/off beaconing LED */ -#define STL_MCLASS_ATTRIB_ID_CABLE_INFO 0x0032 /* Cable Information */ +#define STL_MCLASS_ATTRIB_ID_SM_INFO 0x0020 /* Subnet Manager Information */ +#define STL_MCLASS_ATTRIB_ID_LED_INFO 0x0031 /* Turn on/off beaconing LED */ +#define STL_MCLASS_ATTRIB_ID_CABLE_INFO 0x0032 /* Cable Information */ #define STL_MCLASS_ATTRIB_ID_AGGREGATE 0x0080 /* Aggregate */ #define STL_MCLASS_ATTRIB_ID_SC_SC_MAPPING_TABLE 0x0081 /* Service Channel to */ @@ -114,8 +114,8 @@ typedef struct { } LIDRouted; struct _STL_DirectedRoute { - STL_LID_32 DrSLID; /* Directed route source LID */ - STL_LID_32 DrDLID; /* Directed route destination LID */ + STL_LID_32 DrSLID; /* Directed route source LID */ + STL_LID_32 DrDLID; /* Directed route destination LID */ uint8 InitPath[64]; /* 64-byte field containing the initial */ /* directed path */ uint8 RetPath[64]; /* 64-byte field containing the */ @@ -176,6 +176,7 @@ typedef struct { #define STL_TRAP_BAD_Q_KEY 0x102 #define STL_TRAP_SWITCH_BAD_PKEY 0x103 #define STL_SMA_TRAP_LINK_WIDTH 0x800 +#define STL_TRAP_COST_MATRIX_CHANGE 0x801 typedef struct { IB_GID Gid; @@ -251,27 +252,6 @@ typedef struct { NodeDescriptionChange:1); } PACK_SUFFIX STL_TRAP_CHANGE_CAPABILITY_DATA; -static __inline -void -BSWAP_STL_TRAP_CHANGE_CAPABILITY_DATA(STL_TRAP_CHANGE_CAPABILITY_DATA *Src) -{ -#if CPU_LE - Src->Lid = ntoh32(Src->Lid); - Src->CapabilityMask.AsReg32 = ntoh32(Src->CapabilityMask.AsReg32); - Src->CapabilityMask3.AsReg16 = ntoh16(Src->CapabilityMask3.AsReg16); - Src->u.AsReg16 = ntoh16(Src->u.AsReg16); -#endif -} - -static __inline -void -BSWAPCOPY_STL_TRAP_CHANGE_CAPABILITY_DATA(STL_TRAP_CHANGE_CAPABILITY_DATA *Src, - STL_TRAP_CHANGE_CAPABILITY_DATA *Dest) -{ - memcpy(Dest, Src, sizeof(STL_TRAP_CHANGE_CAPABILITY_DATA)); - BSWAP_STL_TRAP_CHANGE_CAPABILITY_DATA(Dest); -} - typedef struct { uint64 SystemImageGuid; uint32 Lid; @@ -351,52 +331,16 @@ typedef struct { /* 56 bytes */ } PACK_SUFFIX STL_TRAP_SWITCH_BAD_PKEY_DATA; -static __inline -void -BSWAP_STL_TRAP_BAD_KEY_DATA(STL_TRAP_BAD_KEY_DATA *Src) -{ -#if CPU_LE - uint64_t temp; - - Src->Lid1 = ntoh32(Src->Lid1); - Src->Lid2 = ntoh32(Src->Lid2); - Src->Key = ntoh32(Src->Key); - // u - // Reserved[3] - temp = ntoh64(Src->Gid1.AsReg64s.H); - Src->Gid1.AsReg64s.H = ntoh64(Src->Gid1.AsReg64s.L); - Src->Gid1.AsReg64s.L = temp; - temp = ntoh64(Src->Gid2.AsReg64s.H); - Src->Gid2.AsReg64s.H = ntoh64(Src->Gid2.AsReg64s.L); - Src->Gid2.AsReg64s.L = temp; - Src->qp1.AsReg32= ntoh32(Src->qp1.AsReg32); - Src->qp2.AsReg32= ntoh32(Src->qp2.AsReg32); -#endif -} - -static __inline -void -BSWAPCOPY_STL_TRAP_BAD_KEY_DATA(STL_TRAP_BAD_KEY_DATA *Src, STL_TRAP_BAD_KEY_DATA *Dest) -{ - memcpy(Dest, Src, sizeof(STL_TRAP_BAD_KEY_DATA)); - BSWAP_STL_TRAP_BAD_KEY_DATA(Dest); -} - /* LinkWidth of at least one port of switch at has changed */ typedef struct { - uint32 ReportingLID; + uint32 ReportingLID; } PACK_SUFFIX STL_SMA_TRAP_DATA_LINK_WIDTH; - - /* * NodeInfo * * Attribute Modifier as: 0 (not used) */ - -#define OUI_TRUESCALE 0x00066a - typedef struct { uint8 BaseVersion; /* RO Supported MAD Base Version */ @@ -862,7 +806,10 @@ typedef struct { uint16 PreemptingLimit; /* RW/HS-E Limit of preempt component of */ /* VL Arbitration table */ /* POD: 0 */ - uint8 ArbitrationHighCap; /* RO/HS-E */ + union { + uint8 ArbitrationHighCap; /* RO/HS-E */ + }; + uint8 ArbitrationLowCap; /* RO/HS-E */ } VL; @@ -1195,8 +1142,7 @@ typedef struct { * Table is a linear array of blocks[2**11]. */ -#define NUM_PKEY_ELEMENTS_BLOCK (PARTITION_TABLE_BLOCK_SIZE) /* Num elements per block; - currently same as IB */ +#define NUM_PKEY_ELEMENTS_BLOCK (32) /* Num elements per block; currently same as IB */ #define MAX_PKEY_BLOCK_NUM 0x7FF #define PKEY_BLOCK_NUM_MASK 0x7FF #define STL_DEFAULT_PKEY 0x7FFF @@ -1388,8 +1334,7 @@ typedef union { * linear array of blocks[2**18]. */ -#define MAX_LFT_ELEMENTS_BLOCK (LFT_BLOCK_SIZE) /* Max elements per block; - currently same as IB */ +#define MAX_LFT_ELEMENTS_BLOCK (64) /* Max elements per block; currently same as IB */ #define MAX_LFT_BLOCK_NUM 0x3FFFF #define STL_NUM_LFT_BLOCKS_PER_DRSMP ((uint8_t)(STL_MAX_PAYLOAD_SMP_DR/MAX_LFT_ELEMENTS_BLOCK)) @@ -1706,66 +1651,6 @@ typedef struct { */ #define STL_AGGREGATE_NEXT(pAggr) (STL_AGGREGATE*)((uint8*)(pAggr)+((pAggr)->Result.s.RequestLength*8)+sizeof(STL_AGGREGATE)) -static __inline -void -BSWAP_STL_AGGREGATE_HEADER(STL_AGGREGATE *Dest) -{ -#if CPU_LE - Dest->AttributeID = ntoh16(Dest->AttributeID); - Dest->Result.AsReg16 = ntoh16(Dest->Result.AsReg16); - Dest->AttributeModifier = ntoh32(Dest->AttributeModifier); -#endif -} - -static __inline -void -ZERO_RSVD_STL_AGGREGATE(STL_AGGREGATE *Dest) -{ - Dest->Result.s.Reserved = 0; -} - -/** - Zero & swap or swap & zero @c segCount segment headers in range [start, end) for network transport. - Stops swapping response on first error segment. When going from host to network order, - stops before swapping segment header to network order if segment header error flag is set. - - Stops when either: next segment is past @c end; @c *segCount segments have been processed; or @c seg->Result.s.Error is not zero. - - @param segCount [in, out] As input, number of segments in [start, end). As output, number of segments processed. - @param hton When true, swap host to network order, otherwise network to host. - - @return Pointer past the last good segment processed (also pointer to first bad segment in case of error). -*/ -static __inline -STL_AGGREGATE * -BSWAP_ZERO_AGGREGATE_HEADERS(STL_AGGREGATE * start, STL_AGGREGATE * end, int * segCount, boolean hton) -{ - int count = 0; - STL_AGGREGATE * h = start; - - while (h < end && count < *segCount) { - if (hton) { - if (h->Result.s.Error) - break; - ZERO_RSVD_STL_AGGREGATE(h); - STL_AGGREGATE * next = STL_AGGREGATE_NEXT(h); - BSWAP_STL_AGGREGATE_HEADER(h); - h = next; - } - else { - BSWAP_STL_AGGREGATE_HEADER(h); - ZERO_RSVD_STL_AGGREGATE(h); - if (h->Result.s.Error) - break; - h = STL_AGGREGATE_NEXT(h); - } - ++count; - } - - *segCount = count; - return h; -} - /* * PortStateInfo * @@ -2119,71 +2004,6 @@ typedef struct { /* RW */ (CONGESTION_CONTROL_TABLE_BLOCKS_PER_MAD * \ STL_NUM_CONGESTION_CONTROL_ELEMENTS_BLOCK_ENTRIES) #define CONGESTION_CONTROL_IMPLEMENTATION_LIMIT 895 -/* - * The following prototype definitions are included in temporary form - * for reference only. They will be reworked as needed and moved into - * the active portion of the header file. - */ -#if 0 - - -/* Reserved (not supported) in Gen1 */ -/* - * PortSnoopInfo - * - * Attribute Modifier as: NNNN NNNN 0000 0000 0000 000A PPPP PPPP - * N: Number of ports - * A=1: All ports starting at P (Set only) - * P: Port number (0 - management port, switches only) - */ - -/* Flit snoop filter: - * each instance defines a flit mask/compare filter -*/ -typedef struct { IB_BITFIELD3( uint16, - Reserved1: 4, - Include: 1, /* RW Filter: 1-include packet, 0-exclude packet */ - Offset: 11 ) /* RW Offset in LTP */ - - uint16 Reserved2; - uint32 Reserved3; - uint64 Mask; /* RW Filter mask */ - uint64 CompareValue; /* RW Filter compare value */ -} PACK_SUFFIX STL_FLIT_FILTER; - -typedef struct { - struct { /* RW Snoop mode control */ - uint8 MirrorPort; /* RW Mirror port: 0-disable snoop */ - - IB_BITFIELD5( uint8, - Reserved1: 4, - FunctSelect: 1, /* RW Filter function select: 0-OR, 1-AND */ - MirrorFlowControl: 1, /* RW Mirrow flow control: 1-enable */ - EgressEnable: 1, /* RW Egress snoop: 1-enable */ - IngressEnable: 1 ) /* RW Ingress snoop: 1-enable */ - - IB_BITFIELD6( uint8, - Reserved2: 3, - SCFilterSupported: 1, /* RO SC filter supported */ - FlitFilter3Supported: 1, /* RO Flit filter 3 supported */ - FlitFilter2Supported: 1, /* RO Flit filter 2 supported */ - FlitFilter1Supported: 1, /* RO Flit filter 1 supported */ - FlitFilter0Supported: 1 ) /* RO Flit filter 0 supported */ - - uint8 Reserved3; - uint32 SCFilter; /* RW SC Filter: 1-snoop SC */ - STL_FLIT_FILTER FlitFilter0; /* RW Flit filter 0 */ - STL_FLIT_FILTER FlitFilter1; /* RW Flit filter 1 */ - STL_FLIT_FILTER FlitFilter2; /* RW Flit filter 2 */ - STL_FLIT_FILTER FlitFilter3; /* RW Flit filter 3 */ - } STL_SnoopControl; - -} PACK_SUFFIX STL_PORT_SNOOP_INFO; - - -/* End of reference definitions */ - -#endif typedef struct { uint64 M_Key; /* A 64 bit key, */ @@ -2198,846 +2018,22 @@ typedef struct { uint8 SMPData[STL_MAX_PAYLOAD_SMP_DR]; /* Up to 'MAX' byte field of SMP */ /* data used to contain the */ /* method's attribute */ -} DRStlSmp_t; +} PACK_SUFFIX DRStlSmp_t; #define STL_SMP_DR_HDR_LEN (sizeof(DRStlSmp_t) - STL_MAX_PAYLOAD_SMP_DR) -static __inline -void -BSWAP_STL_DR_SMP(DRStlSmp_t *Dest) -{ -#if CPU_LE - Dest->M_Key = ntoh64(Dest->M_Key); - Dest->DrSLID = ntoh32(Dest->DrSLID); - Dest->DrDLID = ntoh32(Dest->DrDLID); -#endif -} - -static __inline -void -BSWAPCOPY_STL_DR_SMP(DRStlSmp_t *Src, DRStlSmp_t *Dest) -{ - memcpy(Dest, Src, sizeof(DRStlSmp_t)); - (void)BSWAP_STL_DR_SMP(Dest); -} - typedef struct { uint64 M_Key; /* A 64 bit key, */ uint8 SMPData[STL_MAX_PAYLOAD_SMP_LR]; /* Up to 'MAX' byte field of SMP */ /* data used to contain the */ /* method's attribute */ -} LRStlSmp_t; +} PACK_SUFFIX LRStlSmp_t; #define STL_SMP_LR_HDR_LEN (sizeof(LRStlSmp_t) - STL_MAX_PAYLOAD_SMP_LR) -#define DRStlMad_Init(MAIP,METHOD,TID,AID,AMOD,MKEY,IPATH) { \ - DRStlSmp_t *drp; \ - \ - (void)memset((void *)&(MAIP)->base, 0, sizeof((MAIP)->base)); \ - \ - (MAIP)->active |= (MAI_ACT_BASE | MAI_ACT_DATA); \ - (MAIP)->base.bversion = STL_BASE_VERSION; \ - (MAIP)->base.mclass = MAD_CV_SUBN_DR; \ - (MAIP)->base.cversion = STL_SM_CLASS_VERSION; \ - (MAIP)->base.method = METHOD; \ - (MAIP)->base.status = 0; \ - (MAIP)->base.hopPointer = 0; \ - (MAIP)->base.hopCount = IPATH[0]; \ - (MAIP)->base.tid = TID; \ - (MAIP)->base.aid = AID; \ - (MAIP)->base.rsvd3 = 0; \ - (MAIP)->base.amod = AMOD; \ - \ - drp = (DRStlSmp_t *)(MAIP)->data; \ - (void)memset((void *)drp, 0, sizeof(*drp)); \ - \ - drp->M_Key = MKEY; \ - drp->DrSLID = STL_LID_PERMISSIVE; \ - drp->DrDLID = STL_LID_PERMISSIVE; \ - \ - (void)memcpy((void *)&drp->InitPath[1], (void *)&IPATH[1], IPATH[0]); \ -} - -#define LRDRStlMad_Init(MAIP,METHOD,TID,AID,AMOD,MKEY,IPATH,SLID) { \ - DRStlSmp_t *drp; \ - \ - (void)memset((void *)&(MAIP)->base, 0, sizeof((MAIP)->base)); \ - \ - (MAIP)->active |= (MAI_ACT_BASE | MAI_ACT_DATA); \ - (MAIP)->base.bversion = STL_BASE_VERSION; \ - (MAIP)->base.mclass = MAD_CV_SUBN_DR; \ - (MAIP)->base.cversion = STL_SM_CLASS_VERSION; \ - (MAIP)->base.method = METHOD; \ - (MAIP)->base.status = 0; \ - (MAIP)->base.hopPointer = 0; \ - (MAIP)->base.hopCount = IPATH[0]; \ - (MAIP)->base.tid = TID; \ - (MAIP)->base.aid = AID; \ - (MAIP)->base.rsvd3 = 0; \ - (MAIP)->base.amod = AMOD; \ - \ - drp = (DRStlSmp_t *)(MAIP)->data; \ - (void)memset((void *)drp, 0, sizeof(*drp)); \ - drp->M_Key = MKEY; \ - drp->DrSLID = SLID; \ - drp->DrDLID = STL_LID_PERMISSIVE; \ - \ - (void)memcpy((void *)&drp->InitPath[1], (void *)&IPATH[1], IPATH[0]); \ -} - -#define LRStlMad_Init(MAIP,MCLASS,METHOD,TID,AID,AMOD,MKEY) { \ - LRStlSmp_t *lrp; \ - \ - (void)memset((void *)&(MAIP)->base, 0, sizeof((MAIP)->base)); \ - \ - (MAIP)->active |= (MAI_ACT_BASE | MAI_ACT_DATA); \ - (MAIP)->base.bversion = STL_BASE_VERSION; \ - (MAIP)->base.mclass = MCLASS; \ - (MAIP)->base.cversion = MCLASS == MAD_CV_SUBN_ADM ? SA_MAD_CVERSION : STL_SM_CLASS_VERSION; \ - (MAIP)->base.method = METHOD; \ - (MAIP)->base.status = 0; \ - (MAIP)->base.hopPointer = 0; \ - (MAIP)->base.hopCount = 0; \ - (MAIP)->base.tid = TID; \ - (MAIP)->base.aid = AID; \ - (MAIP)->base.rsvd3 = 0; \ - (MAIP)->base.amod = AMOD; \ - \ - lrp = (LRStlSmp_t *)(MAIP)->data; \ - (void)memset((void *)lrp, 0, sizeof(*lrp)); \ - \ - lrp->M_Key = MKEY; \ -} - -// USER ADVICE: Be careful with casting and using the macros below: -// There exist two versions of stl_get_smp_data: -// 1: Uses Mai_t* input parmaeter to be used with MAI API (a macro) -// 2: Uses STL_SMP* input parameter to be used with opamgt API (Tools) -#define STL_GET_SMP_DATA(MAIP) ((maip->base.mclass == MAD_CV_SUBN_DR) ? \ - ((DRStlSmp_t *)(maip->data))->SMPData : ((LRStlSmp_t *)(maip->data))->SMPData) - -#define STL_GET_MAI_KEY(MAIP) ((maip->base.mclass == MAD_CV_SUBN_DR) ? \ - &(((DRStlSmp_t *)(maip->data))->M_Key) : &(((LRStlSmp_t *)(maip->data))->M_Key)) - -static inline uint8_t *stl_get_smp_data(STL_SMP *smp) -{ - if (smp->common.MgmtClass == MCLASS_SM_DIRECTED_ROUTE) { - return smp->SmpExt.DirectedRoute.SMPData; - } - return smp->SmpExt.LIDRouted.SMPData; -} - -static inline size_t stl_get_smp_data_size(STL_SMP *smp) -{ - if (smp->common.MgmtClass == MCLASS_SM_DIRECTED_ROUTE) { - return STL_MAX_PAYLOAD_SMP_DR; - } - return STL_MAX_PAYLOAD_SMP_LR; -} - -static inline size_t stl_get_smp_header_size(STL_SMP * smp) -{ - return sizeof(STL_SMP) - stl_get_smp_data_size(smp); -} - #include "iba/public/ipackoff.h" - -static __inline -uint8 -GET_STL_PORT_INFO_NeighborMTU(const STL_PORT_INFO *PortInfo, uint8 vl) { - if (vl & 0x01) - return(PortInfo->NeighborMTU[(vl & 0x1F) / 2].s.VL1_to_MTU); - else - return(PortInfo->NeighborMTU[(vl & 0x1F) / 2].s.VL0_to_MTU); -} - -static __inline -void -PUT_STL_PORT_INFO_NeighborMTU(STL_PORT_INFO *PortInfo, uint8 vl, uint8 mtu) { - if (vl & 0x01) - PortInfo->NeighborMTU[(vl & 0x1F) / 2].s.VL1_to_MTU = mtu & 0x0F; - else - PortInfo->NeighborMTU[(vl & 0x1F) / 2].s.VL0_to_MTU = mtu & 0x0F; -} - -/* Is the Smp given from a local requestor (eg. on the same host such as a - * smp from IbAccess to its own local port or from a local SM) - * allow HopPointer to be 0 for direct use of GetSetMad and - * 1 for packets which passed through SMI prior to GetSetMad - */ -static __inline -boolean -STL_SMP_IS_LOCAL( - IN STL_SMP *Smp - ) -{ - return (( MCLASS_SM_DIRECTED_ROUTE == Smp->common.MgmtClass ) && - ( Smp->common.u.DR.HopPointer == 0 - || Smp->common.u.DR.HopPointer == 1) && - ( Smp->common.u.DR.HopCount == 0 )); -} - -static __inline -void -STL_SMP_SET_LOCAL( - IN STL_SMP *Smp - ) -{ - Smp->common.MgmtClass = MCLASS_SM_DIRECTED_ROUTE; - Smp->common.u.DR.HopPointer = 0; - Smp->common.u.DR.HopCount = 0; - Smp->SmpExt.DirectedRoute.DrSLID = STL_LID_PERMISSIVE; - Smp->SmpExt.DirectedRoute.DrDLID = STL_LID_PERMISSIVE; -} - -static __inline -void -BSWAP_STL_SMP_HEADER(STL_SMP *Dest) -{ -#if CPU_LE - BSWAP_MAD_HEADER((MAD *)Dest); - - Dest->M_Key = ntoh64(Dest->M_Key); - if (Dest->common.MgmtClass == MCLASS_SM_DIRECTED_ROUTE) { - Dest->SmpExt.DirectedRoute.DrSLID = \ - ntoh32(Dest->SmpExt.DirectedRoute.DrSLID); - Dest->SmpExt.DirectedRoute.DrDLID = \ - ntoh32(Dest->SmpExt.DirectedRoute.DrDLID); - } -#endif -} - -static __inline -void -BSWAPCOPY_STL_SMP(STL_SMP *Src, STL_SMP *Dest) -{ - memcpy(Dest, Src, sizeof(STL_SMP)); - (void)BSWAP_STL_SMP_HEADER(Dest); -} - -#define STL_BSWAP_SMP_HEADER BSWAP_STL_SMP_HEADER /* Temporary definition */ - - -static __inline -void -BSWAP_STL_TRAP_PORT_CHANGE_STATE_DATA(STL_TRAP_PORT_CHANGE_STATE_DATA * data) -{ -#if CPU_LE - data->Lid = ntoh32(data->Lid); -#endif -} - -static __inline -void -BSWAP_STL_SMA_TRAP_DATA_LINK_WIDTH(STL_SMA_TRAP_DATA_LINK_WIDTH *Dest) -{ -#if CPU_LE - Dest->ReportingLID = ntoh32(Dest->ReportingLID); -#endif -} - - -static __inline -void -BSWAP_STL_NODE_DESCRIPTION(STL_NODE_DESCRIPTION *Dest) -{ -#if CPU_LE - /* pure text field, nothing to swap */ -#endif -} - - -static __inline -void -BSWAP_STL_NODE_INFO(STL_NODE_INFO *Dest) -{ -#if CPU_LE - Dest->SystemImageGUID = ntoh64(Dest->SystemImageGUID ); - Dest->NodeGUID = ntoh64(Dest->NodeGUID); - Dest->PortGUID = ntoh64(Dest->PortGUID); - Dest->PartitionCap = ntoh16(Dest->PartitionCap); - Dest->DeviceID = ntoh16(Dest->DeviceID); - Dest->Revision = ntoh32(Dest->Revision); - Dest->u1.AsReg32 = ntoh32(Dest->u1.AsReg32); -#endif -} - - -/* NOTE: for this implementation the cost of checking for and handling - * overlapping memory regions is assumed to be higher than warranted. - */ -static __inline -void -BSWAPCOPY_STL_NODE_INFO(STL_NODE_INFO *Src, STL_NODE_INFO *Dest) -{ -if (Src != Dest) - (void)memcpy((void *)Dest, (void *)Src, sizeof(STL_NODE_INFO)); - -BSWAP_STL_NODE_INFO(Dest); -} - - -static __inline -void -BSWAP_STL_SWITCH_INFO(STL_SWITCH_INFO *Dest) -{ -#if CPU_LE - Dest->LinearFDBCap = ntoh32(Dest->LinearFDBCap); - Dest->PortGroupFDBCap = ntoh32(Dest->PortGroupFDBCap); - Dest->MulticastFDBCap = ntoh32(Dest->MulticastFDBCap); - Dest->LinearFDBTop = ntoh32(Dest->LinearFDBTop); - Dest->MulticastFDBTop = ntoh32(Dest->MulticastFDBTop); - Dest->CollectiveCap = ntoh32(Dest->CollectiveCap); - Dest->CollectiveTop = ntoh32(Dest->CollectiveTop); - Dest->PartitionEnforcementCap = ntoh16(Dest->PartitionEnforcementCap); - Dest->AdaptiveRouting.AsReg16 = ntoh16(Dest->AdaptiveRouting.AsReg16); - Dest->CapabilityMask.AsReg16 = ntoh16(Dest->CapabilityMask.AsReg16); - Dest->CapabilityMaskCollectives.AsReg16 = ntoh16(Dest->CapabilityMaskCollectives.AsReg16); -#endif -} - -static __inline -void -ZERO_RSVD_STL_SWITCH_INFO(STL_SWITCH_INFO * Dest) -{ - Dest->Reserved = 0; - Dest->Reserved21 = 0; - Dest->Reserved22 = 0; - Dest->Reserved23 = 0; - - Dest->Reserved24 = 0; - - Dest->u2.s.Reserved20 = 0; - Dest->u2.s.Reserved21 = 0; - Dest->u2.s.Reserved22 = 0; - Dest->u2.s.Reserved23 = 0; - Dest->u2.s.Reserved = 0; - - Dest->MultiCollectMask.Reserved = 0; - Dest->AdaptiveRouting.s.Reserved = 0; -} - -static __inline -void -BSWAPCOPY_STL_SWITCH_INFO(STL_SWITCH_INFO *Src, STL_SWITCH_INFO *Dest) -{ - if (Src != Dest) memcpy((void *)Dest, (void *)Src, sizeof(STL_SWITCH_INFO)); - BSWAP_STL_SWITCH_INFO(Dest); -} - -static __inline -void -BSWAP_STL_MKEY(uint64_t *mkey) -{ -#if CPU_LE - *mkey = ntoh64(*mkey); -#endif -} - -static __inline -void -BSWAPCOPY_STL_MKEY(uint64_t *Src, uint64_t *Dest) -{ - if (Src != Dest) memcpy((void *)Dest, (void *)Src, sizeof(uint64_t)); - BSWAP_STL_MKEY(Dest); -} - -static __inline -void -BSWAP_STL_PORT_INFO(STL_PORT_INFO *Dest) -{ -#if CPU_LE - Dest->LID = ntoh32(Dest->LID); - Dest->FlowControlMask = ntoh32(Dest->FlowControlMask); - Dest->VL.HighLimit = ntoh16(Dest->VL.HighLimit); - Dest->VL.PreemptingLimit = ntoh16(Dest->VL.PreemptingLimit); - Dest->PortStates.AsReg32 = ntoh32(Dest->PortStates.AsReg32); - Dest->P_Keys.P_Key_8B = ntoh16(Dest->P_Keys.P_Key_8B); - Dest->P_Keys.P_Key_10B = ntoh16(Dest->P_Keys.P_Key_10B); - Dest->Violations.M_Key = ntoh16(Dest->Violations.M_Key); - Dest->Violations.P_Key = ntoh16(Dest->Violations.P_Key); - Dest->Violations.Q_Key = ntoh16(Dest->Violations.Q_Key); - Dest->SM_TrapQP.AsReg32 = ntoh32(Dest->SM_TrapQP.AsReg32); - Dest->SA_QP.AsReg32 = ntoh32(Dest->SA_QP.AsReg32); - Dest->LinkSpeed.Supported = ntoh16(Dest->LinkSpeed.Supported); - Dest->LinkSpeed.Enabled = ntoh16(Dest->LinkSpeed.Enabled); - Dest->LinkSpeed.Active = ntoh16(Dest->LinkSpeed.Active); - Dest->LinkWidth.Supported = ntoh16(Dest->LinkWidth.Supported); - Dest->LinkWidth.Enabled = ntoh16(Dest->LinkWidth.Enabled); - Dest->LinkWidth.Active = ntoh16(Dest->LinkWidth.Active); - Dest->LinkWidthDowngrade.Supported = ntoh16(Dest->LinkWidthDowngrade.Supported); - Dest->LinkWidthDowngrade.Enabled = ntoh16(Dest->LinkWidthDowngrade.Enabled); - Dest->LinkWidthDowngrade.TxActive = ntoh16(Dest->LinkWidthDowngrade.TxActive); - Dest->LinkWidthDowngrade.RxActive = ntoh16(Dest->LinkWidthDowngrade.RxActive); - Dest->PortLinkMode.AsReg16 = ntoh16(Dest->PortLinkMode.AsReg16); - Dest->PortLTPCRCMode.AsReg16 = ntoh16(Dest->PortLTPCRCMode.AsReg16); - Dest->PortMode.AsReg16 = ntoh16(Dest->PortMode.AsReg16); - Dest->PortPacketFormats.Supported = ntoh16(Dest->PortPacketFormats.Supported); - Dest->PortPacketFormats.Enabled = ntoh16(Dest->PortPacketFormats.Enabled); - Dest->FlitControl.Interleave.AsReg16 = ntoh16(Dest->FlitControl.Interleave.AsReg16); - Dest->FlitControl.Preemption.MinInitial = ntoh16(Dest->FlitControl.Preemption.MinInitial); - Dest->FlitControl.Preemption.MinTail = ntoh16(Dest->FlitControl.Preemption.MinTail); - Dest->PortErrorAction.AsReg32 = ntoh32(Dest->PortErrorAction.AsReg32); - Dest->M_KeyLeasePeriod = ntoh16(Dest->M_KeyLeasePeriod); - Dest->BufferUnits.AsReg32 = ntoh32(Dest->BufferUnits.AsReg32); - Dest->MasterSMLID = ntoh32(Dest->MasterSMLID); - Dest->M_Key = ntoh64(Dest->M_Key); - Dest->SubnetPrefix = ntoh64(Dest->SubnetPrefix); - Dest->NeighborNodeGUID = ntoh64(Dest->NeighborNodeGUID); - Dest->CapabilityMask.AsReg32 = ntoh32(Dest->CapabilityMask.AsReg32); - Dest->CapabilityMask3.AsReg16 = ntoh16(Dest->CapabilityMask3.AsReg16); - Dest->OverallBufferSpace = ntoh16(Dest->OverallBufferSpace); - Dest->DiagCode.AsReg16 = ntoh16(Dest->DiagCode.AsReg16); -#endif -} - -static __inline -void -ZERO_RSVD_STL_PORT_INFO(STL_PORT_INFO * Dest) -{ - Dest->VL.s2.Reserved = 0; - Dest->PortStates.s.Reserved = 0; - Dest->PortPhysConfig.s.Reserved = 0; - Dest->MultiCollectMask.Reserved = 0; - Dest->s1.Reserved = 0; - Dest->s3.Reserved20 = 0; - Dest->s3.Reserved21 = 0; - Dest->s4.Reserved = 0; - Dest->SM_TrapQP.s.Reserved = 0; - Dest->SA_QP.s.Reserved = 0; - Dest->PortLinkMode.s.Reserved = 0; - Dest->PortLTPCRCMode.s.Reserved = 0; - Dest->PortMode.s.Reserved = 0; - Dest->PortMode.s.Reserved2 = 0; - Dest->PortMode.s.Reserved3 = 0; - Dest->FlitControl.Interleave.s.Reserved = 0; - Dest->Reserved13 = 0; - Dest->PortErrorAction.s.Reserved = 0; - Dest->PortErrorAction.s.Reserved2 = 0; - Dest->PortErrorAction.s.Reserved3 = 0; - Dest->PortErrorAction.s.Reserved4 = 0; - Dest->PassThroughControl.Reserved = 0; - Dest->BufferUnits.s.Reserved = 0; - Dest->Reserved14 = 0; - // Reserved fields in the RO section - Dest->Reserved20 = 0; - Dest->CapabilityMask.s.CmReserved6 = 0; - Dest->CapabilityMask.s.CmReserved24 = 0; - Dest->CapabilityMask.s.CmReserved5 = 0; - Dest->CapabilityMask.s.CmReserved23 = 0; - Dest->CapabilityMask.s.CmReserved22 = 0; - Dest->CapabilityMask.s.CmReserved21 = 0; - Dest->CapabilityMask.s.CmReserved25 = 0; - Dest->CapabilityMask.s.CmReserved2 = 0; - Dest->CapabilityMask.s.CmReserved20 = 0; - Dest->CapabilityMask.s.CmReserved1 = 0; - Dest->Reserved20 = 0; - Dest->CapabilityMask3.s.CmReserved = 0; - Dest->Reserved23 = 0; - Dest->Reserved21 = 0; - Dest->PortNeighborMode.Reserved = 0; - Dest->MTU.Reserved20 = 0; - Dest->Resp.Reserved = 0; - Dest->Reserved24 = 0; -} - -static __inline -void -BSWAP_STL_PARTITION_TABLE(STL_PARTITION_TABLE *Dest) -{ -#if CPU_LE - uint32 i; - - for (i = 0; i < NUM_PKEY_ELEMENTS_BLOCK; i++) - { - Dest->PartitionTableBlock[i].AsReg16 = \ - ntoh16(Dest->PartitionTableBlock[i].AsReg16); - } -#endif -} - -static __inline -void -BSWAPCOPY_STL_PARTITION_TABLE(STL_PARTITION_TABLE *Src, STL_PARTITION_TABLE *Dest) -{ - if (Src != Dest) memcpy(Dest, Src, sizeof(STL_PARTITION_TABLE)); - BSWAP_STL_PARTITION_TABLE(Dest); -} - - -static __inline -void -BSWAP_STL_SLSCMAP(STL_SLSCMAP *Dest) -{ -#if CPU_LE - /* nothing to swap */ -#endif -} - -static __inline -void -ZERO_RSVD_STL_SLSCMAP(STL_SLSCMAP * Dest) -{ - uint32 i; - for (i = 0; i < sizeof(Dest->SLSCMap)/sizeof(Dest->SLSCMap[0]); ++i) { - Dest->SLSCMap[i].Reserved = 0; - } -} - -static __inline -void -BSWAP_STL_SCSCMAP(STL_SCSCMAP *Dest) -{ -#if CPU_LE - /* nothing to swap */ -#endif -} - - -static __inline -void -BSWAP_STL_SCSLMAP(STL_SCSLMAP *Dest) -{ -#if CPU_LE - /* nothing to swap */ -#endif -} - -static __inline -void -ZERO_RSVD_STL_SCSLMAP(STL_SCSLMAP *Dest) -{ - uint32 i; - for (i = 0; i < sizeof(Dest->SCSLMap)/sizeof(Dest->SCSLMap[0]); ++i) { - Dest->SCSLMap[i].Reserved = 0; - } -} - -static __inline -void -BSWAP_STL_SCVLMAP(STL_SCVLMAP *Dest) -{ -#if CPU_LE - /* nothing to swap */ -#endif -} - -static __inline -void -ZERO_RSVD_STL_SCVLMAP(STL_SCVLMAP *Dest) -{ - uint32 i; - for (i = 0; i < sizeof(Dest->SCVLMap)/sizeof(Dest->SCVLMap[0]); ++i) { - Dest->SCVLMap[i].Reserved = 0; - } -} -/* The section flag refers to which section of STL_VLARB_TABLE - * is to be swapped (see STL_VLARB_TABLE). Only the Preemption - * Matrix section (STL_VLARB_PREEMPT_MATRIX) requires action. - */ -static __inline -void -BSWAP_STL_VLARB_TABLE(STL_VLARB_TABLE *Dest, int section) -{ -#if CPU_LE - uint32 i; - - if (section == STL_VLARB_PREEMPT_MATRIX) - { - for (i = 0; i < STL_MAX_VLS; i++) - Dest->Matrix[i] = ntoh32(Dest->Matrix[i]); - } -#endif -} - -static __inline -void -ZERO_RSVD_STL_VLARB_TABLE(STL_VLARB_TABLE *Dest, uint8 section) -{ - if (section != STL_VLARB_PREEMPT_MATRIX) { - uint32 i; - for (i = 0; i < VLARB_TABLE_LENGTH; ++i) - Dest->Elements[i].s.Reserved = 0; - } -} - -static __inline -void -BSWAP_STL_LINEAR_FORWARDING_TABLE(STL_LINEAR_FORWARDING_TABLE *Dest) -{ -#if CPU_LE - /* nothing to swap */ -#endif -} - - -static __inline -void -BSWAP_STL_MULTICAST_FORWARDING_TABLE(STL_MULTICAST_FORWARDING_TABLE *Dest) -{ -#if CPU_LE - uint32 i; - - for (i = 0; i < STL_NUM_MFT_ELEMENTS_BLOCK; i++) - { - Dest->MftBlock[i] = ntoh64(Dest->MftBlock[i]); - } -#endif -} - -static __inline -void -BSWAP_STL_SM_INFO(STL_SM_INFO *Dest) -{ -#if CPU_LE - Dest->PortGUID = ntoh64(Dest->PortGUID); - Dest->SM_Key = ntoh64(Dest->SM_Key); - Dest->ActCount = ntoh32(Dest->ActCount); - Dest->ElapsedTime = ntoh32(Dest->ElapsedTime); - Dest->u.AsReg16 = ntoh16(Dest->u.AsReg16); -#endif -} - -static __inline -void -BSWAPCOPY_STL_SM_INFO(STL_SM_INFO *Src, STL_SM_INFO *Dest) -{ - memcpy(Dest, Src, sizeof(STL_SM_INFO)); - BSWAP_STL_SM_INFO(Dest); -} - - -static __inline -void -BSWAP_STL_LED_INFO(STL_LED_INFO *Dest) -{ -#if CPU_LE - Dest->u.AsReg32 = ntoh32(Dest->u.AsReg32); -#endif -} - -static __inline -void -ZERO_RSVD_STL_LED_INFO(STL_LED_INFO *Dest) { - - Dest->Reserved2 = 0; - -} - - -static __inline -void -BSWAP_STL_CABLE_INFO(STL_CABLE_INFO *Dest) -{ -#if CPU_LE - /* nothing to swap */ -#endif -} - - -static __inline -void -BSWAP_STL_AGGREGATE(STL_AGGREGATE *Dest) -{ -#if CPU_LE - Dest->AttributeID = ntoh16(Dest->AttributeID); - Dest->Result.AsReg16 = ntoh16(Dest->Result.AsReg16); - Dest->AttributeModifier = ntoh32(Dest->AttributeModifier); -#endif -} - - -/* num_ports is the number of port entries in STL_PORT_STATE_INFO */ -static __inline -void -BSWAP_STL_PORT_STATE_INFO(STL_PORT_STATE_INFO *Dest, uint8 num_ports) -{ -#if CPU_LE - uint32 i; - - for (i = 0; i < num_ports; i++) - { - Dest[i].PortStates.AsReg32 = ntoh32(Dest[i].PortStates.AsReg32); - Dest[i].LinkWidthDowngradeTxActive = ntoh16(Dest[i].LinkWidthDowngradeTxActive); - Dest[i].LinkWidthDowngradeRxActive = ntoh16(Dest[i].LinkWidthDowngradeRxActive); - } -#endif -} - - -static __inline -void -BSWAP_STL_PORT_GROUP_FORWARDING_TABLE(STL_PORT_GROUP_FORWARDING_TABLE *Dest) -{ -#if CPU_LE - /* nothing to swap */ -#endif -} - - -static __inline -void -BSWAP_STL_PORT_GROUP_TABLE(STL_PORT_GROUP_TABLE *Dest) -{ -#if CPU_LE - uint32 i; - - for (i = 0; i < NUM_PGT_ELEMENTS_BLOCK; i++) - { - Dest->PgtBlock[i] = ntoh64(Dest->PgtBlock[i]); - } -#endif -} - - -static __inline -void -BSWAP_STL_BUFFER_CONTROL_TABLE(STL_BUFFER_CONTROL_TABLE *Dest) -{ -#if CPU_LE - uint32 i; - - Dest->TxOverallSharedLimit = ntoh16(Dest->TxOverallSharedLimit); - - for (i = 0; i < STL_MAX_VLS; i++) - { - Dest->VL[i].TxDedicatedLimit = ntoh16(Dest->VL[i].TxDedicatedLimit); - Dest->VL[i].TxSharedLimit = ntoh16(Dest->VL[i].TxSharedLimit); - } -#endif -} - - -static __inline -void -BSWAP_STL_CONGESTION_INFO(STL_CONGESTION_INFO *Dest) -{ -#if CPU_LE - Dest->CongestionInfo = ntoh16(Dest->CongestionInfo); -#endif -} - - -/* num_blocks is the number of blocks in STL_SWITCH_CONGESTION_LOG to swap */ -static __inline -void -BSWAP_STL_SWITCH_CONGESTION_LOG(STL_SWITCH_CONGESTION_LOG *Dest) -{ -#if CPU_LE - uint32 i; - - Dest->LogEventsCounter = ntoh16(Dest->LogEventsCounter); - Dest->CurrentTimeStamp = ntoh32(Dest->CurrentTimeStamp); - - for (i = 0; i < STL_NUM_CONGESTION_LOG_ELEMENTS; i++) - { - Dest->CongestionEntryList[i].SLID = ntoh32(Dest->CongestionEntryList[i].SLID); - Dest->CongestionEntryList[i].DLID = ntoh32(Dest->CongestionEntryList[i].DLID); - Dest->CongestionEntryList[i].TimeStamp = ntoh32(Dest->CongestionEntryList[i].TimeStamp); - } -#endif -} - - -static __inline -void -BSWAP_STL_SWITCH_CONGESTION_SETTING(STL_SWITCH_CONGESTION_SETTING *Dest) -{ -#if CPU_LE - Dest->Control_Map = ntoh32(Dest->Control_Map); - Dest->CS_ReturnDelay = ntoh16(Dest->CS_ReturnDelay); - Dest->Marking_Rate = ntoh16(Dest->Marking_Rate); -#endif -} - -static __inline -void -ZERO_RSVD_STL_SWITCH_CONGESTION_SETTING(STL_SWITCH_CONGESTION_SETTING *Dest) -{ - Dest->Reserved = 0; - Dest->Reserved2 = 0; - Dest->Reserved3 = 0; -} - -/* num_ports is the number of ports in STL_SWITCH_PORT_CONGESTION_SETTING to swap */ -static __inline -void -BSWAP_STL_SWITCH_PORT_CONGESTION_SETTING(STL_SWITCH_PORT_CONGESTION_SETTING *Dest, uint8 num_ports) -{ -#if CPU_LE - uint32 i; - - for (i = 0; i < num_ports; i++) - { - Dest->Elements[i].Marking_Rate = ntoh16(Dest->Elements[i].Marking_Rate); - } -#endif -} - - -/* num_blocks is the number of blocks in STL_HFI_CONGESTION_LOG to swap */ -static __inline -void -BSWAP_STL_HFI_CONGESTION_LOG(STL_HFI_CONGESTION_LOG *Dest) -{ -#if CPU_LE - uint32 i; - - Dest->ThresholdEventCounter = ntoh16(Dest->ThresholdEventCounter); - Dest->CurrentTimeStamp = ntoh16(Dest->CurrentTimeStamp); - - for (i = 0; i < STL_NUM_CONGESTION_LOG_ELEMENTS; i++) - { - Dest->CongestionEntryList[i].Remote_LID_CN_Entry = - ntoh32(Dest->CongestionEntryList[i].Remote_LID_CN_Entry); - Dest->CongestionEntryList[i].TimeStamp_CN_Entry = - ntoh32(Dest->CongestionEntryList[i].TimeStamp_CN_Entry); - } -#endif -} - - -static __inline -void -BSWAP_STL_HFI_CONGESTION_SETTING(STL_HFI_CONGESTION_SETTING *Dest) -{ -#if CPU_LE - uint32 i; - - Dest->Port_Control = ntoh16(Dest->Port_Control); - Dest->Control_Map = ntoh32(Dest->Control_Map); - - for (i = 0; i < STL_MAX_SLS; i++) - { - Dest->HFICongestionEntryList[i].CCTI_Timer = - ntoh16(Dest->HFICongestionEntryList[i].CCTI_Timer); - } -#endif -} - - -/* num_blocks is the number of blocks in STL_HFI_CONGESTION_CONTROL_TABLE to swap */ -static __inline -void -BSWAP_STL_HFI_CONGESTION_CONTROL_TABLE(STL_HFI_CONGESTION_CONTROL_TABLE *Dest, uint8 num_blocks) -{ -#if CPU_LE - uint32 i,j; - - Dest->CCTI_Limit = ntoh16(Dest->CCTI_Limit); - - for(i = 0; i < num_blocks; ++i) { - for (j = 0; j < STL_NUM_CONGESTION_CONTROL_ELEMENTS_BLOCK_ENTRIES; ++j) { - Dest->CCT_Block_List[i].CCT_Entry_List[j].AsReg16 = - ntoh16(Dest->CCT_Block_List[i].CCT_Entry_List[j].AsReg16); - } - } -#endif -} - - #if defined (__cplusplus) }; #endif -#endif /* __IBA_STL_SM_H__ */ +#endif /* __IBA_STL_SM_TYPES_H__ */ diff --git a/IbAccess/Common/Inc/stl_t.h b/IbAccess/Common/Inc/stl_t.h index 32f2fe8c..e5f7b105 100644 --- a/IbAccess/Common/Inc/stl_t.h +++ b/IbAccess/Common/Inc/stl_t.h @@ -37,7 +37,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "iba/ib_ibt.h" -#include "iba/stl_sa.h" +#include "iba/stl_sa_priv.h" #include "iba/stl_sd.h" #if defined(VXWORKS) @@ -47,12 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #else #include "iba/ib_cm.h" #endif -#include "iba/ib_pa.h" +#include "iba/stl_pa_priv.h" #include "iba/ib_types.h" -//#include "iba/ib_avtracker.h" -//#include "iba/umadt.h" - #ifdef __cplusplus }; #endif diff --git a/IbAccess/Common/Inc/umadt.h b/IbAccess/Common/Inc/umadt.h index d5d16351..d312a85a 100644 --- a/IbAccess/Common/Inc/umadt.h +++ b/IbAccess/Common/Inc/umadt.h @@ -34,8 +34,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include -#include +#include +#include #include #if defined (__cplusplus) diff --git a/IbAccess/Common/Inc/vpi.h b/IbAccess/Common/Inc/vpi.h index df7ae9f2..b60e5e96 100644 --- a/IbAccess/Common/Inc/vpi.h +++ b/IbAccess/Common/Inc/vpi.h @@ -37,7 +37,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * and Service Level Interface */ -#include "iba/stl_types.h" +#include "iba/ib_types.h" #ifdef __cplusplus extern "C" { diff --git a/IbAccess/Common/Inc/vpi_export.h b/IbAccess/Common/Inc/vpi_export.h index e75abf94..b872c6a8 100644 --- a/IbAccess/Common/Inc/vpi_export.h +++ b/IbAccess/Common/Inc/vpi_export.h @@ -35,7 +35,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "iba/vpi.h" #include "stl_types.h" -#include "stl_sm.h" +#include "stl_sm_priv.h" #ifdef __cplusplus extern "C" { diff --git a/IbAccess/Common/Public/ibyteswap.h b/IbAccess/Common/Public/ibyteswap.h index 56316747..16ff6943 100644 --- a/IbAccess/Common/Public/ibyteswap.h +++ b/IbAccess/Common/Public/ibyteswap.h @@ -38,8 +38,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * __BIG_ENDIAN * __BYTE_ORDER * - * If the platform provides byte swapping functions, ibyteswap_osd.h also - * provides the following macros. + * If the platform does not provide byte swapping functions, ibyteswap_osd.h + * will also provide the following macros. * ntoh16, hton16 * ntoh32, hton32 * ntoh64, hton64 diff --git a/IbAccess/Common/SubnetDriver/multicast.h b/IbAccess/Common/SubnetDriver/multicast.h index ecf2c9b7..5b31ed42 100644 --- a/IbAccess/Common/SubnetDriver/multicast.h +++ b/IbAccess/Common/SubnetDriver/multicast.h @@ -33,7 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define _MULTICAST_H #include -#include +#include #include #include diff --git a/IbAccess/Common/SubnetDriver/query.c b/IbAccess/Common/SubnetDriver/query.c index 8a282872..5520e322 100644 --- a/IbAccess/Common/SubnetDriver/query.c +++ b/IbAccess/Common/SubnetDriver/query.c @@ -33,7 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include +#include #include LOCKED_QUICK_LIST *pQueryList = NULL; diff --git a/IbAccess/Common/SubnetDriver/query.h b/IbAccess/Common/SubnetDriver/query.h index 7049aad2..b28848b8 100644 --- a/IbAccess/Common/SubnetDriver/query.h +++ b/IbAccess/Common/SubnetDriver/query.h @@ -30,7 +30,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include +#include #include +#include #include #include #include diff --git a/IbAccess/Common/SubnetDriver/report.c b/IbAccess/Common/SubnetDriver/report.c index e31f1c8c..8f31eb3d 100644 --- a/IbAccess/Common/SubnetDriver/report.c +++ b/IbAccess/Common/SubnetDriver/report.c @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include "iba/stl_mad.h" +#include "iba/stl_mad_priv.h" #include #include #include diff --git a/IbAccess/Common/SubnetDriver/sdi.h b/IbAccess/Common/SubnetDriver/sdi.h index 07d222c4..513d88ca 100644 --- a/IbAccess/Common/SubnetDriver/sdi.h +++ b/IbAccess/Common/SubnetDriver/sdi.h @@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include #ifdef __cplusplus diff --git a/IbAccess/UserCommon/Inc/ibt.h b/IbAccess/UserCommon/Inc/ibt.h index 72700458..284326cd 100644 --- a/IbAccess/UserCommon/Inc/ibt.h +++ b/IbAccess/UserCommon/Inc/ibt.h @@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "iba/ib_ibt.h" #include "iba/stl_types.h" #include "iba/stl_sd.h" -#include "iba/stl_pa.h" +#include "iba/stl_pa_priv.h" #if defined(VXWORKS) #ifdef BUILD_CM #include "iba/ib_cm.h" diff --git a/IbAccess/UserLinux/Inc/Makefile b/IbAccess/UserLinux/Inc/Makefile index 6f96f334..14f83ecf 100644 --- a/IbAccess/UserLinux/Inc/Makefile +++ b/IbAccess/UserLinux/Inc/Makefile @@ -66,24 +66,28 @@ INCLUDE_TARGETS = \ $(COMMON_SRCDIR)/ib_helper.h \ $(COMMON_SRCDIR)/ib_mad.h \ $(COMMON_SRCDIR)/ib_pkt.h \ - $(COMMON_SRCDIR)/ib_pm.h \ - $(COMMON_SRCDIR)/ib_bm.h \ - $(COMMON_SRCDIR)/ib_pa.h \ $(COMMON_SRCDIR)/ib_rmpp.h \ $(COMMON_SRCDIR)/ib_sa_records.h \ + $(COMMON_SRCDIR)/ib_sa_records_priv.h \ $(COMMON_SRCDIR)/ib_sd.h \ + $(COMMON_SRCDIR)/ib_sd_priv.h \ $(COMMON_SRCDIR)/ib_cm.h \ - $(COMMON_SRCDIR)/ib_sm.h \ + $(COMMON_SRCDIR)/ib_sm_priv.h \ + $(COMMON_SRCDIR)/ib_sm_types.h \ $(COMMON_SRCDIR)/ib_status.h \ $(COMMON_SRCDIR)/ib_types.h \ $(COMMON_SRCDIR)/ipublic.h \ $(COMMON_SRCDIR)/stl_helper.h \ - $(COMMON_SRCDIR)/stl_mad.h \ - $(COMMON_SRCDIR)/stl_pa.h \ + $(COMMON_SRCDIR)/stl_mad_priv.h \ + $(COMMON_SRCDIR)/stl_mad_types.h \ + $(COMMON_SRCDIR)/stl_pa_priv.h \ + $(COMMON_SRCDIR)/stl_pa_types.h \ $(COMMON_SRCDIR)/stl_pkt.h \ $(COMMON_SRCDIR)/stl_pm.h \ - $(COMMON_SRCDIR)/stl_sm.h \ - $(COMMON_SRCDIR)/stl_sa.h \ + $(COMMON_SRCDIR)/stl_sm_priv.h \ + $(COMMON_SRCDIR)/stl_sm_types.h \ + $(COMMON_SRCDIR)/stl_sa_priv.h \ + $(COMMON_SRCDIR)/stl_sa_types.h \ $(COMMON_SRCDIR)/stl_sd.h \ $(COMMON_SRCDIR)/stl_t.h \ $(COMMON_SRCDIR)/stl_types.h \ diff --git a/IbAccess/UserLinux/Makerules.module b/IbAccess/UserLinux/Makerules.module index 1a16e41d..64ae654b 100644 --- a/IbAccess/UserLinux/Makerules.module +++ b/IbAccess/UserLinux/Makerules.module @@ -71,7 +71,7 @@ MOD_BIN_SUBDIR = MOD_DRIVER_BIN_SUBDIR = MOD_INCLUDE_SUBDIR = iba -MOD_INCLUDE_DIRS = . $(GLOBAL_INCLUDE_DIR)/$(MOD_INCLUDE_SUBDIR) $(GLOBAL_INCLUDE_DIR)/iba/public $(KERNELDIR)/include +MOD_INCLUDE_DIRS = . $(GLOBAL_INCLUDE_DIR)/$(MOD_INCLUDE_SUBDIR) $(GLOBAL_INCLUDE_DIR)/iba/public MOD_LIB_DIRS = $(MOD_LIB_DIR) MODDEPLIBS = MODLIBS = diff --git a/IbPrint/Makefile b/IbPrint/Makefile index 4e087b66..f4ea609c 100644 --- a/IbPrint/Makefile +++ b/IbPrint/Makefile @@ -52,7 +52,6 @@ CFILES = \ stl_pa.c \ types.c \ sma.c \ - pm.c \ sa.c \ sd.c \ mad.c \ diff --git a/IbPrint/ibprint.h b/IbPrint/ibprint.h index 211fec24..5970e141 100644 --- a/IbPrint/ibprint.h +++ b/IbPrint/ibprint.h @@ -35,8 +35,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include -#include +#include +#include typedef enum { PL_NONE = 0, // no output @@ -211,12 +211,6 @@ extern void PrintInformInfo(PrintDest_t *dest, int indent, const IB_INFORM_INFO *pInformInfo); extern void PrintInformInfoRecord(PrintDest_t *dest, int indent, const IB_INFORM_INFO_RECORD *pInformInfoRecord); -extern void PrintVfInfo(PrintDest_t *dest, int indent, - const VEND_VFINFO_RECORD *pVfInfo); -extern void PrintVfInfoCSV(PrintDest_t *dest, int indent, - const VEND_VFINFO_RECORD *pVfInfo); -extern void PrintVfInfoCSV2(PrintDest_t *dest, int indent, - const VEND_VFINFO_RECORD *pVfInfo); /////////////////////////////////////////////////////////////////////////////// // IbAccess SubnetDriver interface @@ -238,13 +232,6 @@ extern int PrintQueryResult(PrintDest_t *dest, int indent, QUERY_RESULT_TYPE OutputType, int csv, FSTATUS status, QUERY_RESULT_VALUES *pResult); -/////////////////////////////////////////////////////////////////////////////// -// PM -extern void FormatPmClassPortInfoCapMask(char buf[80], uint16 cmask); -extern void FormatPmClassPortInfoCapMask2(char buf[80], uint32 cmask); -extern void PrintPortCounters(PrintDest_t *dest, int indent, - const PORT_COUNTERS *pPortCounters); - /////////////////////////////////////////////////////////////////////////////// // Print with additional information. extern void PrintExtendedPathRecord(PrintDest_t *dest, int indent, diff --git a/IbPrint/pm.c b/IbPrint/pm.c deleted file mode 100644 index 095ce23f..00000000 --- a/IbPrint/pm.c +++ /dev/null @@ -1,117 +0,0 @@ -/* BEGIN_ICS_COPYRIGHT7 **************************************** - -Copyright (c) 2015, Intel Corporation - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of Intel Corporation nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -** END_ICS_COPYRIGHT7 ****************************************/ - -/* [ICS VERSION STRING: unknown] */ - -#include -#include -#include -#include -#include -#include -#include "ibprint.h" - -void FormatPmClassPortInfoCapMask(char buf[80], uint16 cmask) -{ - FormatClassPortInfoCapMask(buf, cmask); - sprintf(buf+strlen(buf), "%s%s", - (cmask & PM_CLASS_PORT_CAPMASK_SAMPLES_ONLY_SUPPORTED)?"SampleOnly ":"", - (cmask & PM_CLASS_PORT_CAPMASK_PORT_COUNTERS_XMIT_WAIT_SUPPORTED)?"XmitWait ":""); -} - -void FormatPmClassPortInfoCapMask2(char buf[80], uint32 cmask) -{ - FormatClassPortInfoCapMask2(buf, cmask); - sprintf(buf+strlen(buf), "%s", - (cmask & PM_CLASS_PORT_CAPMASK2_VENDOR_PORT_COUNTERS)?"VendCntr ":""); -} - -void PrintPortCounters(PrintDest_t *dest, int indent, const PORT_COUNTERS *pPortCounters) -{ - PrintFunc(dest, "%*sPerformance: Transmit\n", indent, ""); - PrintFunc(dest, "%*s Xmit Data %10u MB (%u Flits)\n", - indent, "", - pPortCounters->PortXmitData/(uint32)FLITS_PER_MB, - pPortCounters->PortXmitData); - PrintFunc(dest, "%*s Xmit Pkts %10u\n", - indent, "", - pPortCounters->PortXmitPkts); - PrintFunc(dest, "%*sPerformance: Receive\n", - indent, ""); - PrintFunc(dest, "%*s Rcv Data %10u MB (%u Flits)\n", - indent, "", - pPortCounters->PortRcvData/(uint32)FLITS_PER_MB, - pPortCounters->PortRcvData); - PrintFunc(dest, "%*s Rcv Pkts %10u\n", - indent, "", - pPortCounters->PortRcvPkts); - PrintFunc(dest, "%*sErrors: \n", - indent, ""); - PrintFunc(dest, "%*s Symbol Errors %10u\n", - indent, "", - pPortCounters->SymbolErrorCounter); - PrintFunc(dest, "%*s Link Error Recovery %10u\n", - indent, "", - pPortCounters->LinkErrorRecoveryCounter); - PrintFunc(dest, "%*s Link Downed %10u\n", - indent, "", - pPortCounters->LinkDownedCounter); - PrintFunc(dest, "%*s Rcv Errors %10u\n", - indent, "", - pPortCounters->PortRcvErrors); - PrintFunc(dest, "%*s Rcv Rmt Phys Err %10u\n", - indent, "", - pPortCounters->PortRcvRemotePhysicalErrors); - PrintFunc(dest, "%*s Rcv Sw Relay Err %10u\n", - indent, "", - pPortCounters->PortRcvSwitchRelayErrors); - PrintFunc(dest, "%*s Xmit Discards %10u\n", - indent, "", - pPortCounters->PortXmitDiscards); - PrintFunc(dest, "%*s Xmit Constraint %10u\n", - indent, "", - pPortCounters->PortXmitConstraintErrors); - PrintFunc(dest, "%*s Rcv Constraint %10u\n", - indent, "", - pPortCounters->PortRcvConstraintErrors); - PrintFunc(dest, "%*s Local Link Integrity %10u\n", - indent, "", - pPortCounters->LocalLinkIntegrityErrors); - PrintFunc(dest, "%*s Exc. Buffer Overrun %10u\n", - indent, "", - pPortCounters->ExcessiveBufferOverrunErrors); - PrintFunc(dest, "%*s VL15 Dropped %10u\n", - indent, "", - pPortCounters->VL15Dropped); -#if 0 // no way to clear counter, no use showing - PrintFunc(dest, "%*s Xmit Wait %10u\n", - indent, "", - pPortCounters->PortXmitWait); -#endif -} diff --git a/IbPrint/sa.c b/IbPrint/sa.c index a65d6896..7df4a3a8 100644 --- a/IbPrint/sa.c +++ b/IbPrint/sa.c @@ -345,100 +345,3 @@ void PrintInformInfoRecord(PrintDest_t *dest, int indent, const IB_INFORM_INFO_R pInformInfoRecord->RID.Enum); PrintInformInfo(dest, indent, &pInformInfoRecord->InformInfoData); } - -void PrintVfInfo(PrintDest_t *dest, int indent, const VEND_VFINFO_RECORD *pVfInfo) -{ - char buf[8]; - char buf2[8]; - - PrintFunc(dest,"%*svFabric Index: %d Name: %s \n", - indent, "", - pVfInfo->vfIndex, - pVfInfo->vfName); - PrintFunc(dest,"%*sServiceId: 0x%016"PRIx64" MGID: 0x%016"PRIx64":0x%016"PRIx64"\n", - indent, "", pVfInfo->ServiceID, - pVfInfo->MGID.AsReg64s.H, - pVfInfo->MGID.AsReg64s.L); - - // FormatTimeoutMult(buf, pVfInfo->s1.pktLifeTimeInc); - snprintf(buf, sizeof(buf), "%d", 1<s1.pktLifeTimeInc); - if ((pVfInfo->routingSLs > 1) && - (pVfInfo->routingSLs+pVfInfo->s1.sl <=16)) { - sprintf(buf2, "%d-%d", pVfInfo->s1.sl, pVfInfo->s1.sl+pVfInfo->routingSLs-1); - } else { - sprintf(buf2, "%d", pVfInfo->s1.sl); - } - PrintFunc(dest,"%*sPKey: 0x%x SL: %s Select: 0x%x%s %s%s PktLifeTimeMult: %s \n", - indent, "", - pVfInfo->pKey, - buf2, - pVfInfo->s1.selectFlags, - pVfInfo->s1.selectFlags? ":" : "", - (pVfInfo->s1.selectFlags&VEND_PKEY_SEL) ? "PKEY " : "", - (pVfInfo->s1.selectFlags&VEND_SL_SEL) ? "SL ": "", - pVfInfo->s1.pktLifeSpecified? buf: "unspecified"); - - if (pVfInfo->s1.mtuSpecified) { - PrintFunc(dest,"%*sMaxMtu: %5s ", - indent, "", - IbMTUToText(pVfInfo->s1.mtu)); - } else { - PrintFunc(dest,"%*sMaxMtu: unlimited ", - indent, ""); - } - - PrintFunc(dest,"%*sMaxRate: %s ", - indent, "", - pVfInfo->s1.rateSpecified ? IbStaticRateToText(pVfInfo->s1.rate) : "unlimited"); - - PrintFunc(dest,"%*sOptions: 0x%x%s %s%s\n", - indent, "", - pVfInfo->optionFlags, - pVfInfo->optionFlags? ":" : "", - (pVfInfo->optionFlags&OPT_VF_SECURITY) ? "Security " : "", - (pVfInfo->optionFlags&OPT_VF_QOS) ? "QoS " : ""); - - if (pVfInfo->optionFlags&OPT_VF_QOS) { - if (pVfInfo->s2.priority) { - if (pVfInfo->bandwidthPercent) { - PrintFunc(dest,"%*sQOS: Bandwidth: %3d%% Priority: %s\n", - indent, "", pVfInfo->bandwidthPercent, "high"); - } else { - PrintFunc(dest,"%*sQOS: HighPriority\n", indent, ""); - } - } else { - PrintFunc(dest,"%*sQOS: Bandwidth: %3d%%\n", - indent, "", pVfInfo->bandwidthPercent); - } - } else { - PrintFunc(dest,"%*sQOS: Disabled\n", - indent, ""); - } -} - -// output VFINFO in a delimited format for easy parsing in shell scripts -void PrintVfInfoCSV(PrintDest_t *dest, int indent, const VEND_VFINFO_RECORD *pVfInfo) -{ - PrintFunc(dest,"%*s%s:%d:0x%x:%d:%s:%s\n", - indent, "", - pVfInfo->vfName, - pVfInfo->vfIndex, - pVfInfo->pKey, - pVfInfo->s1.sl, - (pVfInfo->s1.mtuSpecified)? IbMTUToText(pVfInfo->s1.mtu):"unlimited", - pVfInfo->s1.rateSpecified ? IbStaticRateToText(pVfInfo->s1.rate) : "unlimited"); -} - -// output VFINFO in a delimited format for easy parsing in shell scripts -void PrintVfInfoCSV2(PrintDest_t *dest, int indent, const VEND_VFINFO_RECORD *pVfInfo) -{ - PrintFunc(dest,"%*s%s:%d:0x%x:%d:%d:%d\n", - indent, "", - pVfInfo->vfName, - pVfInfo->vfIndex, - pVfInfo->pKey, - pVfInfo->s1.sl, - (pVfInfo->s1.mtuSpecified)? pVfInfo->s1.mtu:0, - pVfInfo->s1.rateSpecified ? pVfInfo->s1.rate:0); -} - diff --git a/IbPrint/sd.c b/IbPrint/sd.c index 46817290..ac7caa3d 100644 --- a/IbPrint/sd.c +++ b/IbPrint/sd.c @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT7 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -36,6 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include "ibprint.h" +#include "ib_sd_priv.h" #include "stl_sd.h" #include "stl_print.h" @@ -641,6 +642,16 @@ void PrintQueryResultValue(PrintDest_t *dest, int indent, PrintDest_t *dbgDest, } break; } + case OutputTypeStlSwitchCostRecord: + { + STL_SWITCH_COST_RECORD_RESULTS *p = (STL_SWITCH_COST_RECORD_RESULTS*)pResult->QueryResult; + for(i = 0; i < p ->NumRecords; ++i) + { + if (i) PrintSeparator(dest); + PrintStlSwitchCostRecord(dest, indent, &p->Records[i]); + } + } + break; default: PrintFunc(dest, "Unsupported OutputType\n"); } diff --git a/IbPrint/sma.c b/IbPrint/sma.c index 178ae84e..a0a04e65 100644 --- a/IbPrint/sma.c +++ b/IbPrint/sma.c @@ -617,9 +617,6 @@ void PrintSmp(PrintDest_t *dest, int indent, const SMP *smp) //smp->common.AttributeModifier >>17, smp->common.AttributeModifier & 0xffff); break; - case MCLASS_ATTRIB_ID_ICS_LED_INFO: - // TBD Hex Dump - break; default: // TBD Hex Dump break; diff --git a/IbPrint/stl_pa.c b/IbPrint/stl_pa.c index ca48fb78..8340aba1 100644 --- a/IbPrint/stl_pa.c +++ b/IbPrint/stl_pa.c @@ -34,7 +34,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include +#include #include #include #include @@ -91,37 +91,37 @@ void PrintStlPAGroupErrorStats(PrintDest_t *dest, int indent, const STL_PM_CATEG PrintFunc(dest, "%*sIntegrity Max %6u Buckets: ", indent, "", pErrStat->categoryMaximums.integrityErrors); - for (i = 0; i < PM_ERR_BUCKETS; i++) + for (i = 0; i < STL_PM_CATEGORY_BUCKETS; i++) PrintFunc(dest, " %4u ", pErrStat->ports[i].integrityErrors); PrintFunc(dest, "\n"); PrintFunc(dest, "%*sCongestion Max %6u Buckets: ", indent, "", pErrStat->categoryMaximums.congestion); - for (i = 0; i < PM_ERR_BUCKETS; i++) + for (i = 0; i < STL_PM_CATEGORY_BUCKETS; i++) PrintFunc(dest, " %4u ", pErrStat->ports[i].congestion); PrintFunc(dest, "\n"); PrintFunc(dest, "%*sSmaCongestion Max %6u Buckets: ", indent, "", pErrStat->categoryMaximums.smaCongestion); - for (i = 0; i < PM_ERR_BUCKETS; i++) + for (i = 0; i < STL_PM_CATEGORY_BUCKETS; i++) PrintFunc(dest, " %4u ", pErrStat->ports[i].smaCongestion); PrintFunc(dest, "\n"); PrintFunc(dest, "%*sBubble Max %6u Buckets: ", indent, "", pErrStat->categoryMaximums.bubble); - for (i = 0; i < PM_ERR_BUCKETS; i++) + for (i = 0; i < STL_PM_CATEGORY_BUCKETS; i++) PrintFunc(dest, " %4u ", pErrStat->ports[i].bubble); PrintFunc(dest, "\n"); PrintFunc(dest, "%*sSecurity Max %6u Buckets: ", indent, "", pErrStat->categoryMaximums.securityErrors); - for (i = 0; i < PM_ERR_BUCKETS; i++) + for (i = 0; i < STL_PM_CATEGORY_BUCKETS; i++) PrintFunc(dest, " %4u ", pErrStat->ports[i].securityErrors); PrintFunc(dest, "\n"); PrintFunc(dest, "%*sRouting Max %6u Buckets: ", indent, "", pErrStat->categoryMaximums.routingErrors); - for (i = 0; i < PM_ERR_BUCKETS; i++) + for (i = 0; i < STL_PM_CATEGORY_BUCKETS; i++) PrintFunc(dest, " %4u ", pErrStat->ports[i].routingErrors); PrintFunc(dest, "\n"); @@ -294,39 +294,6 @@ void PrintStlPAPortCounters(PrintDest_t *dest, int indent, const STL_PORT_COUNTE indent, "", pPortCounters->portRcvBubble); PrintStlPAImageId(dest, indent+2, &pPortCounters->imageId); -#if 0 - if (flags & STL_PA_PC_FLAG_DELTA) { - if (pPortCounters->PortCheckRate) { - PrintFunc(dest, "%*s %s %20"PRIu64" (%3u.%1u%%) (Inefficiency %3u.%1u%%)\n", - indent, "", - IbPortCongestionNameToText(pPortCounters->PortCheckRate), - pPortCounters->PortXmitCongestion, - pPortCounters->CongestionPct10/10, - pPortCounters->CongestionPct10%10, - pPortCounters->InefficiencyPct10/10, - pPortCounters->InefficiencyPct10%10); - PrintFunc(dest, "%*s %-22s%10u %s\n", - indent, "", - IbPortCheckRateTypeToText(pPortCounters->PortCheckRate), - pPortCounters->PortCheckRate & PM_VENDOR_PORT_COUNTERS_RATE_VALUE_MASK, - IbPortCheckRateTypeSuffixToText(pPortCounters->PortCheckRate) - ); - } else { - PrintFunc(dest, "%*s Port Xmit Congestion Unavailable\n", - indent, ""); - } - if (pPortCounters->PortCheckRate - && (pPortCounters->PortCheckRate & PM_VENDOR_PORT_COUNTERS_RATE_TYPE_MASK) - == PM_VENDOR_PORT_COUNTERS_RATE_TYPE_CONG) { - PrintFunc(dest, "%*s Port Adaptive Routing %20"PRIu64"\n", - indent, "", - pPortCounters->PortAdaptiveRouting); - } else { - PrintFunc(dest, "%*s Port Adaptive Routing N/A\n", - indent, ""); - } - } -#endif } void PrintStlPAGroupConfig(PrintDest_t *dest, int indent, const char *groupName, const int numRecords, const STL_PA_PM_GROUP_CFG_RSP *pGroupConfig) diff --git a/IbPrint/stl_print.h b/IbPrint/stl_print.h index 24b9607a..399d1df1 100644 --- a/IbPrint/stl_print.h +++ b/IbPrint/stl_print.h @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT7 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -32,8 +32,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef __STL_PRINT_H__ #define __STL_PRINT_H__ -#include "iba/stl_sm.h" -#include "iba/stl_sa.h" +#include "iba/stl_mad_priv.h" +#include "iba/stl_sm_priv.h" +#include "iba/stl_sa_priv.h" #include "iba/stl_sd.h" #include "iba/stl_pm.h" #include "ibprint.h" @@ -155,6 +156,7 @@ void PrintBfrCtlTableRecord(PrintDest_t *dest, int indent, const STL_BUFFER_CONT void PrintStlCableInfoRecord(PrintDest_t *dest, int indent, const STL_CABLE_INFO_RECORD *pCableInfoRecord); void PrintStlPortGroupTabRecord(PrintDest_t *dest, int indent, const STL_PORT_GROUP_TABLE_RECORD *pRecord); void PrintStlPortGroupFwdTabRecord(PrintDest_t *dest, int indent, const STL_PORT_GROUP_FORWARDING_TABLE_RECORD *pRecord); +void PrintStlSwitchCostRecord(PrintDest_t *dest, int indent, const STL_SWITCH_COST_RECORD *pRecord); // len is real length of cable data void PrintStlPortSummary(PrintDest_t *dest, int indent, const char* portName, const STL_PORT_INFO *pPortInfo, EUI64 portGuid, uint16_t g_pkey, const uint8_t *cableInfoData, uint16_t addr, uint8_t len, const STL_PORT_STATUS_RSP *pPortStatusRsp, uint8_t detail, int printLineByLine); diff --git a/IbPrint/stl_sa.c b/IbPrint/stl_sa.c index 064390a9..700bd8da 100644 --- a/IbPrint/stl_sa.c +++ b/IbPrint/stl_sa.c @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT7 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "stl_print.h" #include -#include +#include #define SIZE_TIME 256 // used in buffer to generate time string for output @@ -329,8 +329,8 @@ void PrintStlVfInfoRecord_detail(PrintDest_t *dest, int indent, int detail, slStr, pVfInfo->s1.selectFlags, pVfInfo->s1.selectFlags? ":" : "", - (pVfInfo->s1.selectFlags&VEND_PKEY_SEL) ? "PKEY " : "", - (pVfInfo->s1.selectFlags&VEND_SL_SEL) ? "SL ": "", + (pVfInfo->s1.selectFlags&STL_VFINFO_REC_SEL_PKEY_QUERY) ? "PKEY " : "", + (pVfInfo->s1.selectFlags&STL_VFINFO_REC_SEL_SL_QUERY) ? "SL ": "", pVfInfo->s1.pktLifeSpecified? buf: "unspecified"); if (pVfInfo->s1.mtuSpecified) { @@ -347,13 +347,13 @@ void PrintStlVfInfoRecord_detail(PrintDest_t *dest, int indent, int detail, PrintFunc(dest, "%*sOptions: 0x%02x%s %s%s%s\n", indent, "", pVfInfo->optionFlags, pVfInfo->optionFlags? ":" : "", - (pVfInfo->optionFlags&OPT_VF_SECURITY) ? "Security " : "", - (pVfInfo->optionFlags&OPT_VF_QOS) ? "QoS " : "", - (pVfInfo->optionFlags&OPT_VF_FLOW_DISABLE) ? "FlowCtrlDisable" : ""); + (pVfInfo->optionFlags&STL_VFINFO_REC_OPT_SECURITY) ? "Security " : "", + (pVfInfo->optionFlags&STL_VFINFO_REC_OPT_QOS) ? "QoS " : "", + (pVfInfo->optionFlags&STL_VFINFO_REC_OPT_FLOW_DISABLE) ? "FlowCtrlDisable" : ""); FormatTimeoutMult(buf, pVfInfo->hoqLife); - if (pVfInfo->optionFlags&OPT_VF_QOS) { + if (pVfInfo->optionFlags&STL_VFINFO_REC_OPT_QOS) { if (pVfInfo->priority) { if (pVfInfo->bandwidthPercent) { PrintFunc(dest,"%*sQOS: Bandwidth: %3d%% Priority: %s PreemptionRank: %u HoQLife: %s\n", @@ -587,6 +587,15 @@ void PrintStlPortGroupFwdTabRecord(PrintDest_t *dest, int indent, const STL_PORT PrintStlPortGroupFDB(dest, indent+4, (STL_PORT_GROUP_FORWARDING_TABLE *) pRecord->PGFdbData, pRecord->RID.u1.s.BlockNum, 0); } +void PrintStlSwitchCostRecord(PrintDest_t *dest, int indent, const STL_SWITCH_COST_RECORD *pRecord) +{ + int i; + PrintFunc(dest, "%*sSource LID: 0x%08x\n", indent, "", pRecord->SLID); + for(i = 0; (i < STL_SWITCH_COST_NUM_ENTRIES) && (pRecord->Cost[i].DLID != 0); ++i){ + PrintFunc(dest, "%*sLID: 0x%08x -> Cost: %u\n", indent+4, "", pRecord->Cost[i].DLID, pRecord->Cost[i].value); + } +} + #define HEXTOCHAR(c) ((isgraph(c)||(c)==' ')?(c):'.') static void FormatChars(char *buf, const uint8* data, uint32 len) diff --git a/IbPrint/stl_sma.c b/IbPrint/stl_sma.c index e1f620e3..200ec3f9 100644 --- a/IbPrint/stl_sma.c +++ b/IbPrint/stl_sma.c @@ -1576,7 +1576,7 @@ void PrintStlVLArbTableSmp(PrintDest_t *dest, int indent, const STL_SMP *smp, ui for (i = 0; i < numPorts; i++) { BSWAP_STL_VLARB_TABLE(pVlArbTab, section); if (nodeType == STL_NODE_SW) { - PrintIntWithDots(dest, indent, "Port: ", port+i); + PrintIntWithDots(dest, indent, "Port", port+i); PrintStlVLArbTable(dest, indent+4, pVlArbTab, section, printLineByLine); } else { PrintStlVLArbTable(dest, indent, pVlArbTab, section, printLineByLine); @@ -2184,7 +2184,7 @@ void PrintStlPortGroupTable(PrintDest_t *dest, int indent, const uint64_t *pPort if (printLineByLine) { for (i=0; i&2 echo " supplied" >&2 echo " FF_ANALYSIS_DIR - top level directory for baselines and failed health checks" >&2 + echo " FF_CHASSIS_CMDS - list of commands to issue during analysis," >&2 + echo " unused if -e option supplied" >&2 + echo " FF_CHASSIS_HEALTH - single command to issue to check overall health during analysis," >&2 + echo " unused if -b option supplied" >&2 echo "for example:" >&2 echo " opaallanalysis" >&2 echo " opaallanalysis -p '1:1 1:2 2:1 2:2'" >&2 diff --git a/IbaTools/FastFabric/opacmdall.sh b/IbaTools/FastFabric/opacmdall.sh index 246700a9..81766033 100755 --- a/IbaTools/FastFabric/opacmdall.sh +++ b/IbaTools/FastFabric/opacmdall.sh @@ -91,7 +91,7 @@ Usage_full() echo " Operations on chassis" >&2 echo " opacmdall -C 'ismPortStats -noprompt'" >&2 echo " opacmdall -C -H 'chassis1 chassis2' 'ismPortStats -noprompt'" >&2 - echo " CHASSIS='chassis1 chassis2' opacmdall 'ismPortStats -noprompt'" >&2 + echo " CHASSIS='chassis1 chassis2' opacmdall -C 'ismPortStats -noprompt'" >&2 exit 0 } diff --git a/IbaTools/FastFabric/opadownloadall.sh b/IbaTools/FastFabric/opadownloadall.sh index d1714543..83b6a5b2 100755 --- a/IbaTools/FastFabric/opadownloadall.sh +++ b/IbaTools/FastFabric/opadownloadall.sh @@ -145,6 +145,8 @@ do done running=0 +pids="" +stat=0 for hostname in $HOSTS do src_files= @@ -157,15 +159,33 @@ do then if [ $running -ge $FF_MAX_PARALLEL ] then - wait + for pid in $pids; do + wait $pid + if [ "$?" -ne 0 ]; then + stat=1 + fi + done + pids="" running=0 fi echo "scp $opts $src_files $user@[$hostname]:$dest" scp $opts $src_files $user@\[$hostname\]:$dest & + pid=$! + pids="$pids $pid" running=$(( $running + 1)) else echo "scp $opts $src_files $user@[$hostname]:$dest" scp $opts $src_files $user@\[$hostname\]:$dest + if [ "$?" -ne 0 ]; then + stat=1 + fi + fi +done + +for pid in $pids; do + wait $pid + if [ "$?" -ne 0 ]; then + stat=1 fi done -wait +exit $stat diff --git a/IbaTools/FastFabric/opafastfabric.pl b/IbaTools/FastFabric/opafastfabric.pl index 20e99d76..32c9c6e5 100755 --- a/IbaTools/FastFabric/opafastfabric.pl +++ b/IbaTools/FastFabric/opafastfabric.pl @@ -1673,7 +1673,7 @@ sub fabricadmin_singlehost my $verifyhosts_tests=""; my $result_dir = read_ffconfig_param("FF_RESULT_DIR"); my $hostverify_sample = "/usr/share/opa/samples/hostverify.sh"; - my $hostverify_original = read_ffconfig_param("FF_HOSTVERIFY_DIR") . "/hostverify.sh"; + my $hostverify_default = read_ffconfig_param("FF_HOSTVERIFY_DIR") . "/hostverify_default.sh"; my $hostverify = ""; my $hostverify_res = "hostverify.res"; my $inp; @@ -1684,43 +1684,44 @@ sub fabricadmin_singlehost if (! valid_config_file("Host File", $FabricAdminHostsFile) ) { return 1; } - if (-e $hostverify_specific && GetYesNo("Would you like to use $hostverify_specific?", "y") ) { + if (GetYesNo("Would you like to use $hostverify_specific?", "y") ) { $use_specific = 1; $hostverify = $hostverify_specific; } else { - $hostverify = $hostverify_original; + $hostverify = $hostverify_default; } - if (GetYesNo("Would you like to copy $hostverify to hosts?", "y") ) { - $verifyhosts_opts="-c"; # copy the hostverify.sh file + if ( ! -e "$hostverify" ) { + copy_data_file("$hostverify_sample", "$hostverify"); + } - while (GetYesNo("Would you like to edit $hostverify?", "y") ) { + if (GetYesNo("Would you like to copy $hostverify_sample to $hostverify?", "n") ) { + copy_data_file("$hostverify_sample", "$hostverify"); + } - if ( ! -e "$hostverify" ) { - copy_data_file("$hostverify_sample", "$hostverify"); - } else { - if(GetYesNo("Would you like to copy $hostverify_sample to $hostverify ", "n")) { - copy_data_file("$hostverify_sample", "$hostverify"); - } - } + if (GetYesNo("Would you like to edit $hostverify?", "y") ) { - print "About to: $Editor $hostverify\n"; - if ( HitKeyContAbortable() == 1) { - return 1; - } - system("$Editor $hostverify"); - if ( ! -e "$hostverify" ) { - print "You must have a $hostverify file to proceed\n\n"; - } else { - last; - } + print "About to: $Editor $hostverify\n"; + if ( HitKeyContAbortable() == 1) { + return 1; } + system("$Editor $hostverify"); if (! $use_specific) { if (GetYesNo("Would you like to save $hostverify locally as $hostverify_specific?", "n") ) { copy_data_file("$hostverify", "$hostverify_specific"); } + } else { + if (GetYesNo("Would you like to save $hostverify locally as $hostverify_default?", "n") ) { + copy_data_file("$hostverify", "$hostverify_default"); + } } } + + print "Choose n below only if $hostverify on hosts has not changed \n"; + if (GetYesNo("Would you like to copy $hostverify to hosts?", "y") ) { + $verifyhosts_opts="-c"; # copy the hostverify.sh file + } + if (GetYesNo("Would you like to specify tests to run?", "n") ) { print "Enter space separated list of hostverify tests [default hpl]: "; chomp($inp = ); diff --git a/IbaTools/FastFabric/opashowallports.sh b/IbaTools/FastFabric/opashowallports.sh index 36879e9f..33c7d0aa 100755 --- a/IbaTools/FastFabric/opashowallports.sh +++ b/IbaTools/FastFabric/opashowallports.sh @@ -69,7 +69,7 @@ Usage_full() echo " HOSTS='elrond arwen' opashowallports" >&2 echo " opashowallports -C" >&2 echo " opashowallports -H 'chassis1 chassis2'" >&2 - echo " CHASSIS='chassis1 chasssi2' opashowallports" >&2 + echo " CHASSIS='chassis1 chassis2' opashowallports -C" >&2 exit 0 } diff --git a/IbaTools/FastFabric/opauploadall.sh b/IbaTools/FastFabric/opauploadall.sh index 9a83ef2d..b44f000f 100755 --- a/IbaTools/FastFabric/opauploadall.sh +++ b/IbaTools/FastFabric/opauploadall.sh @@ -151,6 +151,8 @@ do done running=0 +pids="" +stat=0 for hostname in $HOSTS do src_files= @@ -168,15 +170,32 @@ do then if [ $running -ge $FF_MAX_PARALLEL ] then - wait + for pid in $pids; do + wait $pid + if [ "$?" -ne 0 ]; then + stat=1 + fi + done + pids="" running=0 fi echo "scp $opts $src_files $UPLOADS_DIR/$hostname/$dest" scp $opts $src_files $UPLOADS_DIR/$hostname/$dest & + pid=$! + pids="$pids $pid" running=$(( $running + 1)) else echo "scp $opts $src_files $UPLOADS_DIR/$hostname/$dest" scp $opts $src_files $UPLOADS_DIR/$hostname/$dest + if [ "$?" -ne 0 ]; then + stat=1 + fi + fi +done +for pid in $pids; do + wait $pid + if [ "$?" -ne 0 ]; then + stat=1 fi done -wait +exit $stat diff --git a/IbaTools/Makerules.module b/IbaTools/Makerules.module index 01f17ca0..74b1efa5 100644 --- a/IbaTools/Makerules.module +++ b/IbaTools/Makerules.module @@ -87,9 +87,6 @@ ifeq "$(TARGET_OS)" "WIN32" endif # WIN32 #=============================================================================# # Include Global makerules definitions and rules -ifdef BUILD_26 -AUTODEP=no -endif include $(TL_DIR)/$(PROJ_FILE_DIR)/Makerules.project #=============================================================================# diff --git a/IbaTools/opaxmlextract/opaextractlink.sh b/IbaTools/opaxmlextract/opaextractlink.sh index cbbbd913..a254746c 100755 --- a/IbaTools/opaxmlextract/opaextractlink.sh +++ b/IbaTools/opaxmlextract/opaextractlink.sh @@ -74,7 +74,8 @@ fi ix=0 -/usr/sbin/opareport -x -o links -d 3 "$@" | \ + +/usr/sbin/opareport -x -o links "$@" -d 3 | \ /usr/sbin/opaxmlextract -d \; -e Rate -e LinkDetails -e CableLength \ -e CableLabel -e CableDetails -e DeviceTechShort -e CableInfo.Length \ -e CableInfo.VendorName -e CableInfo.VendorPN -e CableInfo.VendorRev \ @@ -88,11 +89,14 @@ do # ... cable information from topology.xml # # - # .. information about 1st port including its CableInfo + # .. information about 1st port excluding its CableInfo # # - # .. information about 2nd port including its CableInfo + # .. information about 2nd port excluding its CableInfo # + # + # .. information about the CableInfo for the cable between the two ports + # # # opaxmlextract produces the following CSV format on each line: # 2 Link values (CSV 1-2) (Rate, LinkDetails) @@ -101,48 +105,57 @@ do # 2 Port values (CSV 11-12) (NodeDesc, PortNum) # due to the nesting of tags, opaxmlextract will output the following # a line with Link and Cable values but empty CableInfo and Port values - # a line for 1st port with Link, CableInfo and Port but empty Cable values - # a line for 2nd port with Link, CableInfo and Port but empty Cable values + # a line for 1st port with Link and Port but empty Cable values + # a line for 2nd port with Link and Port but empty Cable values + # a line which contains the link and CableInfo. # if the topology.xml file is not supplied or has no information for the # given link, opareport will not output the section and the # 1st line above will not be output by opaxmlextract for the given link case $ix in 0) - # process heading and build new per link heading for this report - echo $line";"`echo $line | cut -d \; -f 11-` - ix=$((ix+1)) - ;; + # process heading and build new per link heading for this report + echo $line";"`echo $line | cut -d \; -f 11-` + ix=$((ix+1)) + ;; 1) - # process 1st line in a given link - line1=`echo $line | cut -d \; -f 1-10` - if [ `echo "$line1" | cut -d \; -f3-5` = ";;" ] - then - # no topology file, we have port information here - line2=`echo $line | cut -d \; -f 11-` - ix=3 - else + # process 1st line in a given link + line1=`echo $line | cut -d \; -f 1-10` + if [ `echo "$line1" | cut -d \; -f 3-5` = ";;" ] + then + # no topology file, we have port information here + line2=`echo $line | cut -d \; -f 11-` + ix=3 + else # have a topology file, port information on next line ix=$((ix+1)) - fi - ;; + fi + ;; 2) - # process 1st port in a given link when we have a topology file - line2=`echo $line | cut -d \; -f 11-` - ix=$((ix+1)) - ;; + # process 1st port in a given link when we have a topology file + line2=`echo $line | cut -d \; -f 11-` + ix=$((ix+1)) + ;; 3) - # process 2nd port in a given link when we have a topology file - # and output a single line for the given link - line3=`echo $line | cut -d \; -f 11-` - echo $line1";"$line2";"$line3 - ix=1 - ;; + # process 2nd port in a given link when we have a topology file + # and output a single line for the given link + line3=`echo $line | cut -d \; -f 11-` + ix=4 + ;; + + 4) + #process the third line for the CableInfo and extract the part of line1 before the CableInfo details in the csv format + line4=`echo $line | cut -d \; -f 6-10` + line1=`echo $line1 | cut -d \; -f 1-5` + # combine all extracted parts from the three input lines into a single output line. + echo $line1";"$line4";"$line2";"$line3 + ix=1 + ;; + esac done exit 0 - diff --git a/IbaTools/opaxmlextract/opaextractstat.sh b/IbaTools/opaxmlextract/opaextractstat.sh index a78531de..a7195361 100755 --- a/IbaTools/opaxmlextract/opaextractstat.sh +++ b/IbaTools/opaxmlextract/opaextractstat.sh @@ -109,7 +109,7 @@ fi ix=0 /usr/sbin/opareport -x -d 10 -s -o errors -T "$@" | \ - /usr/sbin/opaxmlextract -d \; -e Rate -e MTU -e LinkDetails -e CableLength \ + /usr/sbin/opaxmlextract -d \; -e Rate -e LinkDetails -e CableLength \ -e CableLabel -e CableDetails -e Port.NodeDesc -e Port.PortNum \ -e LinkQualityIndicator.Value | while read line do diff --git a/IbaTools/opaxmlextract/opaextractstat2.sh b/IbaTools/opaxmlextract/opaextractstat2.sh index 44a91511..d9f2945f 100755 --- a/IbaTools/opaxmlextract/opaextractstat2.sh +++ b/IbaTools/opaxmlextract/opaextractstat2.sh @@ -107,7 +107,7 @@ fi ix=0 /usr/sbin/opareport -x -d 10 -s -o errors -T "$@" | \ - /usr/sbin/opaxmlextract -d \; -e Rate -e MTU -e Internal -e LinkDetails \ + /usr/sbin/opaxmlextract -d \; -e Rate -e Internal -e LinkDetails \ -e CableLength -e CableLabel -e CableDetails -e Port.NodeGUID \ -e Port.PortGUID -e Port.PortNum -e Port.PortType -e Port.NodeDesc \ -e Port.PortDetails \ diff --git a/MakeTools/make_src_tar.sh b/MakeTools/make_src_tar.sh new file mode 100755 index 00000000..3b04f139 --- /dev/null +++ b/MakeTools/make_src_tar.sh @@ -0,0 +1,78 @@ +# BEGIN_ICS_COPYRIGHT8 **************************************** +# +# Copyright (c) 2017, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# END_ICS_COPYRIGHT8 **************************************** + +#[ICS VERSION STRING: unknown] +#!/bin/sh +# This script is used to to create source tar for rpm +# Required arguments: $RELEASE_TYPE $SrcRoot $USE_UNIFDEF $ARCHIVE $FILES_TO_TAR $FILE_TO_EXCLUDE +set -x +RELEASE_TYPE="$1" +SrcRoot="$2" +USE_UNIFDEF="$3" +ARCHIVE="$4" +FILES_TO_TAR="$5" +FILE_TO_EXCLUDE="$6" +if [[ "${RELEASE_TYPE}" == "EMBARGOED" ]] +then + echo "Building Embargoed Release." + export OPA_LICENSE_DIR=${TL_DIR}/CodeTemplates/EmbargoedNotices + # use tar command to copy files to temp dir + # then run update_license on files in temp dir + TMP=$(mktemp -d) + tar c -C ${SrcRoot} ${FILES_TO_TAR} --exclude-vcs --ignore-case $FILE_TO_EXCLUDE | \ + tar x -C ${TMP} + ${TL_DIR}/CodeTemplates/update_license.sh -c -q $TMP + SrcRoot=${TMP} +else + echo "Building Public Release." +fi + +if [[ $USE_UNIFDEF = "yes" ]] ; then + # Check if unifdef tool exists + type unifdef > /dev/null 2>&1 || { echo "error: unifdef tool missing"; exit 1; } + # For unifdef, use tar command to copy files to temp dirs + # then run unifdef on files in temp dir + SrcTmp=$(mktemp -d) + tar c -C ${SrcRoot} ${FILES_TO_TAR} --exclude-vcs --ignore-case $FILE_TO_EXCLUDE | \ + tar x -C ${SrcTmp} + find ${SrcTmp}/ -type f -regex ".*\.[ch][p]*$" -exec unifdef -m -f "${TL_DIR}/buildFeatureDefs" {} \; + SrcRoot=${SrcTmp} + # Delete content of buildFeatureDefs before creating source tar for rpm + >${SrcRoot}/buildFeatureDefs +fi + +tar cvzf ${ARCHIVE} -C ${SrcRoot} ${FILES_TO_TAR} --exclude-vcs --ignore-case $FILE_TO_EXCLUDE + +# Remove temp dir +if [[ "${RELEASE_TYPE}" == "EMBARGOED" ]] ; then + rm -rf ${TMP} +fi +if [[ $USE_UNIFDEF = "yes" ]] ; then + rm -rf ${SrcTmp} +fi diff --git a/MakeTools/patch_version/patch_version.c b/MakeTools/patch_version/patch_version.c index ff480c6a..3333e07d 100755 --- a/MakeTools/patch_version/patch_version.c +++ b/MakeTools/patch_version/patch_version.c @@ -88,15 +88,15 @@ and/or the product takes a long amount of time to compile. // the string and returns it. // It accepts no arguments and returns NULL if the string cannot // be evaluated. - // The version number created can also be extracted by the Unix "what" - // command. + // The version number created can also be extracted by the strings command + // or the internal whatversion tool // #define ICS_BUILD_VERSION "THIS_IS_THE_ICS_VERSION_NUMBER:@(#)000.000.000.000B000" const char* GetCodeVersion(void) { static const char* BuildVersion=ICS_BUILD_VERSION; static char* version; - static built=0; + static int built=0; if (!built) { // locate start of version string, @@ -112,7 +112,7 @@ and/or the product takes a long amount of time to compile. { static const char* BuildBrand=ICS_BUILD_BRAND; static char* brand; - static built=0; + static int built=0; if (!built) { // locate start of brand string, diff --git a/Makerules/Maketargets.build b/Makerules/Maketargets.build index 2b8c1799..86d9f2b8 100755 --- a/Makerules/Maketargets.build +++ b/Makerules/Maketargets.build @@ -51,7 +51,7 @@ endif ifneq "$(strip $(LIB_TARGETS_ARLIB))" "" # archive/static library -# FIXME: BUILDDIR path prefix for target +# BUILDDIR is in LIB_PREFIX and hence in LIB_TARGETS_ARLIB CT_OBJECTS = $(foreach f,$(OBJECTS),$(BUILDDIR)/$(f)) $(LIB_TARGETS_ARLIB): $(ARLIBS) $(CT_OBJECTS) $(RSCOBJECTS) @mkdir -p $(dir $@) @@ -67,7 +67,7 @@ endif ifneq "$(strip $(CMD_TARGETS_SHLIB))" "" # shared library/DLL -# FIXME: BUILDDIR path prefix for target +# BUILDDIR is in LIB_PREFIX and hence in CMD_TARGETS_SHLIB CT_OBJECTS = $(foreach f,$(OBJECTS),$(BUILDDIR)/$(f)) # don't use $^, would have deplibs explicit on line $(CMD_TARGETS_SHLIB): $(ARLIBS) $(CT_OBJECTS) $(EXP_TARGET) $(RSCOBJECTS) $(DEPLIBS_TARGETS) @@ -123,8 +123,7 @@ $(BUILDDIR)/$(CMD_TARGETS_EXE) : $(CT_OBJECTS) $(RSCOBJECTS) $(DEPLIBS_TARGETS) $(RM) $(RMFORCE) partialImage.o ctdt.c ctdt.o else # BUILD_TARGET_OS is not VXWORKS -# FIXME, need to fix CMD_TARGETS_EXE to have BUILDDIR prefixing it -# This may need update in all makefiles? Especially when referenced for STAGE: +# In Makefiles CMD_TARGETS_EXE must have BUILDDIR prefixing it $(CMD_TARGETS_EXE) : $(CT_OBJECTS) $(RSCOBJECTS) $(DEPLIBS_TARGETS) @echo Linking executable... @mkdir -p $(dir $@) diff --git a/Makerules/Maketargets.product b/Makerules/Maketargets.product index ce0d0192..f0a3745d 100755 --- a/Makerules/Maketargets.product +++ b/Makerules/Maketargets.product @@ -92,6 +92,10 @@ endif ifneq "$(VXWORKS_REV_6_9)" "" PRODUCT_DEFINES += -DVXWORKS_REV_6_9=$(VXWORKS_REV_6_9) endif + +# include buildFeatureDefs to let inplace build work for stream consistency +PRODUCT_DEFINES += -include $(TL_DIR)/buildFeatureDefs + ifneq "$(STL_GEN)" "" PRODUCT_DEFINES += -DSTL_GEN=$(STL_GEN) endif diff --git a/Makerules/README b/Makerules/README index 20963e8e..3cf224a1 100755 --- a/Makerules/README +++ b/Makerules/README @@ -312,7 +312,7 @@ ## ## ##MAKEDEPEND = System makedepend application (Windows Only, on others -## $(CC) -MM $(DEPENDFLAGS) is used) +## $(CC) $(DEPENDFLAGS) -MT $(BUILDIR)/$*.o -MM is used) ##DEPENDFLAGS = makedepend flags for .c files ##CCDEPENDFLAGS = makedepend flags for .cpp files ##DEPENDMOD = module level defined makedepend flags [Not Defined] diff --git a/Makerules/Rules.Common b/Makerules/Rules.Common index ee24800b..ac390029 100755 --- a/Makerules/Rules.Common +++ b/Makerules/Rules.Common @@ -209,6 +209,7 @@ else # AUTODEP cmds: check_env buildcmds cmdsonly: check_env buildcmdsonly endif #AUTODEP +.PHONY: libsonly cmdsonly DEPEND_MK_FILE = $(BUILDDIR)/depend.mk @@ -226,7 +227,7 @@ buildall: $(DEPEND_MK_FILE) .PHONY: INCLUDES LIBS CMDS .PHONY: includes imports libs cmds -.PHONY: buildincludes buildimports buildlibs buildcmds buildall check_env +.PHONY: buildincludes buildimports buildlibs buildlibsonly buildcmds buildcmdsonly buildall check_env check_env:: check_target check_config check_platform check_subsystem check_usemfc check_windbase check_mipspath check_i386path check_target_bsp @@ -250,6 +251,7 @@ check_brand:: ifneq "$(BRANDIT)" "" BRAND_DIRS := $(BRANDIT) endif +.PHONY: check_brand #FIXME - this CARD_TYPE check should be cleaned up @@ -334,6 +336,7 @@ endif ifneq "$(MOD_SBR_DIR)" "$(PROJ_SBR_DIR)" -$(VS)$(RM) $(RMFORCE) $(RMRECURSE) $(MOD_SBR_DIR) endif +.PHONY: clobber_module clobber_stage:: check_env -$(VS)$(RM) $(RMFORCE) $(RMRECURSE) $(STAGE_DIR) @@ -346,6 +349,7 @@ clobber_release:: check_env # cd $(PROJ_STAGE_LIB_DIR) && $(INSTALL) -d $(PROJ_RELEASE_LIB_DIR) * # cd $(PROJ_STAGE_BIN_DIR) && $(INSTALL) -d $(PROJ_RELEASE_BIN_DIR) * # cd $(PROJ_STAGE_SBR_DIR) && $(INSTALL) -d $(PROJ_RELEASE_SBR_DIR) * +#.PHONY: release cleandepend:: check_env CLEANDEPEND CLEANDEPEND:: @@ -409,14 +413,14 @@ ifneq "$(strip $(BUILDDIR))" "" $(BUILDDIR)/%.c.dep: %.c @echo "Updating $< Dependencies" @mkdir -p $(dir $@) - $(CC) $(DEPENDFLAGS) -MM $< > $@ + $(CC) $(DEPENDFLAGS) -MT $(BUILDDIR)/$*.o -MM $< > $@ ifneq "$(CARD_TYPE)" "" $(STRIPDEPENDS) $@ endif $(BUILDDIR)/%.cpp.dep: %.cpp @echo "Updating $< Dependencies" @mkdir -p $(dir $@) - $(CC) $(CCDEPENDFLAGS) -MM $< > $@ + $(CC) $(CCDEPENDFLAGS) -MT $(BUILDDIR)/$*.o -MM $< > $@ ifneq "$(CARD_TYPE)" "" $(STRIPDEPENDS) $@ endif @@ -446,6 +450,7 @@ stage:: STAGE stageboot:: check_env @echo "Staging Bootloader Product(s)" stageboot:: STAGEBOOT +.PHONY: stageboot runtest:: check_env all @echo "Running Unit Test(s)" @@ -704,7 +709,7 @@ else check_config: endif # BUILD_CONFIG in SUPPORTED_CONFIGS endif # BUILD_CONFIG defined -.PHONY: SUPPORTED_CONFIGS +.PHONY: SUPPORTED_CONFIGS check_config ifeq "$(BUILD_TARGET_OS)" "WIN32" #-----------------------------------------------------------------------------# @@ -869,7 +874,7 @@ else check_root: endif # UID is 0 else -checkroot: +check_root: endif # BUILD_PLATFORM LINUX ifeq "$(BUILD_PLATFORM)" "DARWIN" # Check if running as root @@ -884,7 +889,7 @@ else check_root: endif # UID is 0 else -checkroot: +check_root: endif # BUILD_PLATFORM DARWIN .PHONY: check_root diff --git a/Topology/mad.c b/Topology/mad.c index 8be061d4..e4d60718 100644 --- a/Topology/mad.c +++ b/Topology/mad.c @@ -840,6 +840,79 @@ FSTATUS SmaGetMulticastFDBTable(struct omgt_port *port, } return fstatus; } + +/* Get PortGroup Table from SMA at lid + * Retry as needed + */ +FSTATUS SmaGetPortGroupTable(struct omgt_port *port, + NodeData *nodep, + uint32_t lid, + uint16 block, + STL_PORT_GROUP_TABLE *pPGT) +{ + STL_SMP smp; + FSTATUS fstatus; + uint32_t modifier; + + MemoryClear(&smp, sizeof(smp)); + // rest of fields should be ignored for a Get, zero'ed above + + DBGPRINT("Sending SMA Get(PortGroup %u) to LID 0x%x Node 0x%016"PRIx64"\n", + block, lid, + nodep->NodeInfo.NodeGUID); + DBGPRINT(" Name: %.*s\n", + STL_NODE_DESCRIPTION_ARRAY_SIZE, + (char*)nodep->NodeDesc.NodeString); + modifier = 0x01000000 + (uint32_t)block; + fstatus = stl_sma_send_recv_mad(port, lid, MMTHD_GET, STL_MCLASS_ATTRIB_ID_PORT_GROUP_TABLE, modifier, &smp); + if (FSUCCESS == fstatus) { + if (smp.common.u.DR.s.Status != MAD_STATUS_SUCCESS) { + DBGPRINT("SMA response with bad status: 0x%x\n", smp.common.u.DR.s.Status); + fstatus = FERROR; + } else { + *pPGT = *(STL_PORT_GROUP_TABLE*)stl_get_smp_data(&smp); + BSWAP_STL_PORT_GROUP_TABLE(pPGT); + } + } + return fstatus; +} + +/* Get PortGroup FDB Table from SMA at lid + * Retry as needed + */ +FSTATUS SmaGetPortGroupFDBTable(struct omgt_port *port, + NodeData *nodep, + uint32_t lid, + uint16 block, + STL_PORT_GROUP_FORWARDING_TABLE *pFDB) +{ + STL_SMP smp; + FSTATUS fstatus; + uint32_t modifier; + + MemoryClear(&smp, sizeof(smp)); + // rest of fields should be ignored for a Get, zero'ed above + + DBGPRINT("Sending SMA Get(PortGroupFDB %u) to LID 0x%x Node 0x%016"PRIx64"\n", + block, lid, + nodep->NodeInfo.NodeGUID); + DBGPRINT(" Name: %.*s\n", + STL_NODE_DESCRIPTION_ARRAY_SIZE, + (char*)nodep->NodeDesc.NodeString); + modifier = 0x01000000 + (uint32_t)block; + fstatus = stl_sma_send_recv_mad(port, lid, MMTHD_GET, STL_MCLASS_ATTRIB_ID_PORT_GROUP_FWD_TABLE, modifier, &smp); + if (FSUCCESS == fstatus) { + if (smp.common.u.DR.s.Status != MAD_STATUS_SUCCESS) { + DBGPRINT("SMA response with bad status: 0x%x\n", smp.common.u.DR.s.Status); + fstatus = FERROR; + } else { + *pFDB = *(STL_PORT_GROUP_FORWARDING_TABLE*)stl_get_smp_data(&smp); + BSWAP_STL_PORT_GROUP_FORWARDING_TABLE(pFDB); + } + } + return fstatus; +} + #endif // PRODUCT_OPENIB_FF /* process a PMA class port info or redirection required response diff --git a/Topology/search.c b/Topology/search.c index 1241fbe4..ba7f2abe 100644 --- a/Topology/search.c +++ b/Topology/search.c @@ -1186,34 +1186,41 @@ FSTATUS FindCableDetailsPatPoint(FabricData_t *fabricp, const char* pattern, Poi FSTATUS FindCabinfLenPatPoint(FabricData_t *fabricp, const char* pattern, Point *pPoint, uint8 find_flag) { FSTATUS status; - uint32 n_pattern = 0; + char *cur, scrubbed_pat[strlen(pattern) + 1]; ASSERT(! PointValid(pPoint)); if (0 == (find_flag & FIND_FLAG_FABRIC)) return FINVALID_OPERATION; - if ((sscanf(pattern, "%3u", &n_pattern) != 1) || (n_pattern > 255)) - { - fprintf(stderr, "%s: Invalid CABLE_INFO length Pattern: %s\n", - g_Top_cmdname, pattern); - return FNOT_FOUND; - } + + // User may suffix pattern with 'm'. Scrub it as to not intefere with later calls + // to fnmatch(). + snprintf(scrubbed_pat, sizeof(scrubbed_pat), "%s", pattern); + if (NULL != (cur = strchr(scrubbed_pat, 'm'))) + *cur = '\0'; + if (find_flag & FIND_FLAG_FABRIC) { LIST_ITEM *p; + for (p=QListHead(&fabricp->AllPorts); p != NULL; p = QListNext(&fabricp->AllPorts, p)) { PortData *portp = (PortData *)QListObj(p); STL_CABLE_INFO_STD *pCableInfo; uint8 xmit_tech; pCableInfo = (STL_CABLE_INFO_STD *)portp->pCableInfoData; - if (! pCableInfo) + if (!pCableInfo) continue; + xmit_tech = pCableInfo->dev_tech.s.xmit_tech; if ( ( ( (xmit_tech <= STL_CIB_STD_TXTECH_1490_DFB) && (xmit_tech != STL_CIB_STD_TXTECH_OTHER) && (pCableInfo->connector == STL_CIB_STD_CONNECTOR_NO_SEP) ) || - (xmit_tech >= STL_CIB_STD_TXTECH_CU_UNEQ) ) && - (pCableInfo->len_om4 == (uint8)n_pattern) ) - { + (xmit_tech >= STL_CIB_STD_TXTECH_CU_UNEQ) )) { + char cablen_str[4] = {0}; // strlen("255") + 1 = 4 + + snprintf(cablen_str, sizeof(cablen_str), "%u", pCableInfo->len_om4); + if (fnmatch(scrubbed_pat, cablen_str, 0) != 0) + continue; + status = PointListAppend(pPoint, POINT_TYPE_PORT_LIST, portp); if (FSUCCESS != status) return status; @@ -1222,12 +1229,12 @@ FSTATUS FindCabinfLenPatPoint(FabricData_t *fabricp, const char* pattern, Point } // N/A for FIND_FLAG_ENODE, FIND_FLAG_ESM and FIND_FLAG_ELINK - if (! PointValid(pPoint)) { - fprintf(stderr, "%s: CABLE_INFO length Not Found: %u\n", - g_Top_cmdname, n_pattern); + fprintf(stderr, "%s: CABLE_INFO length Not Found: %s\n", + g_Top_cmdname, pattern); return FNOT_FOUND; } + PointCompress(pPoint); return FSUCCESS; diff --git a/Topology/sweep.c b/Topology/sweep.c index 58984295..539c5868 100644 --- a/Topology/sweep.c +++ b/Topology/sweep.c @@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. static int g_skipswitchinfo= 0; // workaround for open SM -static int g_paclient_state = PACLIENT_UNKNOWN; // PaClient/PaServer communications +static int g_paclient_state = OMGT_SERVICE_STATE_UNKNOWN; // PaClient/PaServer communications static FILE *g_verbose_file = NULL; // file for verbose output static struct omgt_port *g_portHandle = NULL; @@ -2332,8 +2332,8 @@ FSTATUS GetAllPortCounters(EUI64 portGuid, IB_GID localGid, FabricData_t *fabric } #ifdef PRODUCT_OPENIB_FF - if ((g_paclient_state == PACLIENT_UNKNOWN) && !(fabricp->flags & FF_PMADIRECT)){ - g_paclient_state = omgt_pa_client_connect(g_portHandle); + if ((g_paclient_state == OMGT_SERVICE_STATE_UNKNOWN) && !(fabricp->flags & FF_PMADIRECT)){ + g_paclient_state = omgt_pa_service_connect(g_portHandle); if (g_paclient_state < 0) { return FERROR; } @@ -2360,7 +2360,7 @@ FSTATUS GetAllPortCounters(EUI64 portGuid, IB_GID localGid, FabricData_t *fabric #ifdef PRODUCT_OPENIB_FF lid = first_portp->PortInfo.LID; #endif - if (g_paclient_state != PACLIENT_OPERATIONAL) { + if (g_paclient_state != OMGT_SERVICE_STATE_OPERATIONAL) { status = GetPathToPort(g_portHandle, portGuid, first_portp); if (FSUCCESS != status) { DBGPRINT("Unable to get Path to Port %d LID 0x%04x Node 0x%016"PRIx64"\n", @@ -2390,7 +2390,7 @@ FSTATUS GetAllPortCounters(EUI64 portGuid, IB_GID localGid, FabricData_t *fabric #ifdef PRODUCT_OPENIB_FF /* use PaClient if available */ - if (g_paclient_state == PACLIENT_OPERATIONAL) + if (g_paclient_state == OMGT_SERVICE_STATE_OPERATIONAL) { if (!first_portp) lid = portp->PortInfo.LID; @@ -2558,7 +2558,7 @@ FSTATUS GetAllPortCounters(EUI64 portGuid, IB_GID localGid, FabricData_t *fabric omgt_close_port(g_portHandle); g_portHandle = NULL; #ifdef PRODUCT_OPENIB_FF - g_paclient_state = PACLIENT_UNKNOWN; + g_paclient_state = OMGT_SERVICE_STATE_UNKNOWN; #endif } @@ -3489,6 +3489,28 @@ static FSTATUS CopyLinearFDBBlock(STL_LINEAR_FORWARDING_TABLE *pDestFwdTbl, PORT return (FSUCCESS); } +/* copy port group FDB block + */ +static FSTATUS CopyPortGroupFDBBlock(STL_PORT_GROUP_FORWARDING_TABLE *pDestFwdTbl, PORT *pSrcFDBData, uint16 blockSize) +{ + if (!pDestFwdTbl || !pSrcFDBData || !blockSize) + return (FINVALID_PARAMETER); + + memcpy(pDestFwdTbl, pSrcFDBData, blockSize); + return (FSUCCESS); +} + +/* copy port group block + */ +static FSTATUS CopyPortGroupBlock(STL_PORTMASK *pDestTbl, STL_PORTMASK *pSrcData, uint16 blockSize) +{ + if (!pDestTbl || !pSrcData || !blockSize) + return (FINVALID_PARAMETER); + + memcpy(pDestTbl, pSrcData, blockSize); + return (FSUCCESS); +} + /* copy multicast FDB block */ static FSTATUS CopyMulticastFDBBlock( NodeData *pNode, STL_PORTMASK *pDestFwdTbl, @@ -3817,10 +3839,15 @@ static FSTATUS GetAllFDBsDirect(struct omgt_port *port, FabricData_t *fabricp, P cl_map_item_t *p; - STL_LINEAR_FORWARDING_TABLE linearFDB; - STL_MULTICAST_FORWARDING_TABLE multicastFDB; + STL_LINEAR_FORWARDING_TABLE linearFDB; + STL_MULTICAST_FORWARDING_TABLE multicastFDB; + STL_PORT_GROUP_TABLE pgt; + STL_PORT_GROUP_FORWARDING_TABLE pgFDB; + uint32 linearFDBSize; // Size increased in STL uint32 multicastFDBSize; + uint32 pgSize; + uint32 pgFDBSize; int num_nodes = cl_qmap_count(&fabricp->AllNodes); @@ -3843,6 +3870,7 @@ static FSTATUS GetAllFDBsDirect(struct omgt_port *port, FabricData_t *fabricp, P linearFDBSize = nodep->pSwitchInfo->SwitchInfoData.LinearFDBTop+1; multicastFDBSize = ComputeMulticastFDBSize(&nodep->pSwitchInfo->SwitchInfoData); limit = ROUNDUP(linearFDBSize,MAX_LFT_ELEMENTS_BLOCK)/MAX_LFT_ELEMENTS_BLOCK; + // Add LinearFDB and MulticastFDB data to SwitchData status = NodeDataAllocateSwitchData( fabricp, nodep, linearFDBSize, multicastFDBSize); @@ -3880,6 +3908,48 @@ static FSTATUS GetAllFDBsDirect(struct omgt_port *port, FabricData_t *fabricp, P } } } + + if (nodep->pSwitchInfo->SwitchInfoData.AdaptiveRouting.s.Enable) { + // Query Port Group FDB records + pgFDBSize = MIN(nodep->pSwitchInfo->SwitchInfoData.LinearFDBTop+1, + nodep->pSwitchInfo->SwitchInfoData.PortGroupFDBCap ? + nodep->pSwitchInfo->SwitchInfoData.PortGroupFDBCap : + DEFAULT_MAX_PGFT_LID+1); + + limit = ROUNDUP(pgFDBSize, NUM_PGFT_ELEMENTS_BLOCK)/NUM_PGFT_ELEMENTS_BLOCK; + for (ix = 0; ix < limit; ix++) { + status = SmaGetPortGroupFDBTable(port, nodep, lid, ix, &pgFDB); + if (status != FSUCCESS) + { + fprintf(stderr, "%*sSMA Get(PortGroupFDB %u) Failed to LID 0x%x Node 0x%016"PRIx64" Name: %.*s: %s\n", 0, "", ix, lid, + nodep->NodeInfo.NodeGUID, + STL_NODE_DESCRIPTION_ARRAY_SIZE, + (char*)nodep->NodeDesc.NodeString, iba_fstatus_msg(status)); + } else { + CopyPortGroupFDBBlock(&nodep->switchp->PortGroupFDB[ix], + pgFDB.PgftBlock, + MIN(pgFDBSize - ix, (int)NUM_PGFT_ELEMENTS_BLOCK)); + } + } + + pgSize = nodep->pSwitchInfo->SwitchInfoData.PortGroupTop; + limit = ROUNDUP(pgSize, NUM_PGT_ELEMENTS_BLOCK)/NUM_PGT_ELEMENTS_BLOCK; + for (ix = 0; ix < limit; ix++) { + status = SmaGetPortGroupTable(port, nodep, lid, ix, &pgt); + if (status != FSUCCESS) + { + fprintf(stderr, "%*sSMA Get(PortGroupTable %u) Failed to LID 0x%x Node 0x%016"PRIx64" Name: %.*s: %s\n", 0, "", ix, lid, + nodep->NodeInfo.NodeGUID, + STL_NODE_DESCRIPTION_ARRAY_SIZE, + (char*)nodep->NodeDesc.NodeString, iba_fstatus_msg(status)); + } else { + CopyPortGroupBlock(&nodep->switchp->PortGroupElements[ix*NUM_PGT_ELEMENTS_BLOCK], + pgt.PgtBlock, + (MIN(pgSize - (ix*NUM_PGT_ELEMENTS_BLOCK), (int)NUM_PGT_ELEMENTS_BLOCK)) * sizeof(STL_PORTMASK)); + } + } + } + } // End of if (nodep->NodeInfo.NodeType == STL_NODE_SW } // End of for ( p=cl_qmap_head(&fabricp->AllNodes) @@ -3940,8 +4010,8 @@ FSTATUS ClearAllPortCounters(EUI64 portGuid, IB_GID localGid, FabricData_t *fabr } #ifdef PRODUCT_OPENIB_FF - if ((g_paclient_state == PACLIENT_UNKNOWN) && !(fabricp->flags & FF_PMADIRECT)) { - g_paclient_state = omgt_pa_client_connect(g_portHandle); + if ((g_paclient_state == OMGT_SERVICE_STATE_UNKNOWN) && !(fabricp->flags & FF_PMADIRECT)) { + g_paclient_state = omgt_pa_service_connect(g_portHandle); if (g_paclient_state < 0) { return FERROR; } @@ -3971,7 +4041,7 @@ FSTATUS ClearAllPortCounters(EUI64 portGuid, IB_GID localGid, FabricData_t *fabr #ifdef PRODUCT_OPENIB_FF lid = first_portp->PortInfo.LID; #endif - if (g_paclient_state != PACLIENT_OPERATIONAL) { + if (g_paclient_state != OMGT_SERVICE_STATE_OPERATIONAL) { status = GetPathToPort(g_portHandle, portGuid, first_portp); if (FSUCCESS != status) { DBGPRINT("Unable to get Path to Port %d LID 0x%04x Node 0x%016"PRIx64"\n", @@ -4005,7 +4075,7 @@ FSTATUS ClearAllPortCounters(EUI64 portGuid, IB_GID localGid, FabricData_t *fabr #ifdef PRODUCT_OPENIB_FF /* use PaClient if available */ - if (g_paclient_state == PACLIENT_OPERATIONAL) + if (g_paclient_state == OMGT_SERVICE_STATE_OPERATIONAL) { STL_PA_IMAGE_ID_DATA imageIdQuery = {PACLIENT_IMAGE_CURRENT, 0}; @@ -4072,7 +4142,7 @@ FSTATUS ClearAllPortCounters(EUI64 portGuid, IB_GID localGid, FabricData_t *fabr omgt_close_port(g_portHandle); g_portHandle = NULL; #ifdef PRODUCT_OPENIB_FF - g_paclient_state = PACLIENT_UNKNOWN; + g_paclient_state = OMGT_SERVICE_STATE_UNKNOWN; #endif } diff --git a/Topology/topology.h b/Topology/topology.h index b28a651e..fbe4c836 100644 --- a/Topology/topology.h +++ b/Topology/topology.h @@ -35,19 +35,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include #if !defined(VXWORKS) || defined(BUILD_DMC) #include #endif -#include -#include +#include +#include #include #include #include #include #include #include -//#include #if !defined(_GNU_SOURCE) #define _GNU_SOURCE #endif @@ -973,9 +971,6 @@ extern FSTATUS InitSmaMkey(uint64 mkey); extern boolean NodeHasPma(NodeData *nodep); extern boolean PortHasPma(PortData *portp); extern void UpdateNodePmaCapabilities(NodeData *nodep, boolean ProcessHFICounters); -extern FSTATUS PmGetClassPortInfo(struct omgt_port *port, PortData *portp); -extern FSTATUS PmGetPortCounters(struct omgt_port *port, PortData *portp, uint8 portNum, - PORT_COUNTERS *pPortCounters); extern FSTATUS STLPmGetClassPortInfo(struct omgt_port *port, PortData *portp); extern FSTATUS STLPmGetPortStatus(struct omgt_port *port, PortData *portp, uint8 portNum, STL_PortStatusData_t *pPortStatus); extern FSTATUS STLPmClearPortCounters(struct omgt_port *port, PortData *portp, uint8 lastPortIndex, uint32 counterselect); diff --git a/Topology/topology_internal.h b/Topology/topology_internal.h index 480f0025..c360d5fe 100644 --- a/Topology/topology_internal.h +++ b/Topology/topology_internal.h @@ -91,6 +91,8 @@ extern FSTATUS SmaGetSCSCMappingTable(struct omgt_port *port, NodeData *nodep, u extern FSTATUS SmaGetSCVLMappingTable(struct omgt_port *port, NodeData *nodep, uint32_t lid, uint8_t port_num, STL_SCVLMAP *pSCVLMap, uint16_t attr); extern FSTATUS SmaGetLinearFDBTable(struct omgt_port *port, NodeData *nodep, uint32_t lid, uint16 block, STL_LINEAR_FORWARDING_TABLE *pFDB); extern FSTATUS SmaGetMulticastFDBTable(struct omgt_port *port, NodeData *nodep, uint32_t lid, uint32 block, uint8 position, STL_MULTICAST_FORWARDING_TABLE *pFDB); +extern FSTATUS SmaGetPortGroupFDBTable(struct omgt_port *port, NodeData *nodep, uint32_t lid, uint16 block, STL_PORT_GROUP_FORWARDING_TABLE *pFDB); +extern FSTATUS SmaGetPortGroupTable(struct omgt_port *port, NodeData *nodep, uint32_t lid, uint16 block, STL_PORT_GROUP_TABLE *pPGT); extern FSTATUS SmaGetBufferControlTable(struct omgt_port *port, NodeData *nodep, uint32_t lid, uint8_t startPort, uint8_t endPort, STL_BUFFER_CONTROL_TABLE pBCT[]); extern FSTATUS SmaGetCableInfo(struct omgt_port *port, NodeData *nodep, uint32_t lid, uint8_t portnum, uint16_t addr, uint8_t len, uint8_t *data); diff --git a/Xml/config_compression.c b/Xml/config_compression.c index b41d0953..751834ac 100755 --- a/Xml/config_compression.c +++ b/Xml/config_compression.c @@ -36,12 +36,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "string.h" #include "taskLib.h" #include "time.h" -//#include "includes.h" -//#include "xmalloc.h" -//#include "atomicio.h" -//#include "pathnames.h" -//#include "log.h" -//#include "misc.h" #include "tms/common/rdHelper.h" #include "tms/idb/icsUiConfigMib.h" #include "tms/common/usrSecLib.h" @@ -49,11 +43,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "bspcommon/h/icsBspUtil.h" #include "bspcommon/h/sysFlash.h" -//#include "adpTaskLib.h" -//#include "adpTimerLib.h" -//#include "adpSocketIoLib.h" -//#include "errnoLib.h" -//#include "Http/FirmwareUpdateApi.h" #include "config_compression.h" extern int UiUtil_GetLocalTime (); diff --git a/Xml/ixml.c b/Xml/ixml.c index af4dcc41..b5f2349d 100644 --- a/Xml/ixml.c +++ b/Xml/ixml.c @@ -29,8 +29,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* [ICS VERSION STRING: unknown] */ #include -#include -#include +#include #if !defined(VXWORKS) || defined(BUILD_DMC) #include #endif diff --git a/Xml/ixml_ib.c b/Xml/ixml_ib.c index 6663d032..231716fb 100644 --- a/Xml/ixml_ib.c +++ b/Xml/ixml_ib.c @@ -29,13 +29,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* [ICS VERSION STRING: unknown] */ #include -#include #if !defined(VXWORKS) || defined(BUILD_DMC) #include #endif -#include -#include -#include "iba/stl_sa.h" +#include +#include +#include "iba/stl_sa_priv.h" +#include "iba/stl_pm.h" #if defined(USE_NETF1_IP_STACK) /* add this to avoid implicit declaration warning in mips/netf1 build */ extern int snprintf (char *str, size_t count, const char *fmt, ...); @@ -526,7 +526,13 @@ void IXmlOutputOptionalVLs(IXmlOutputState_t *state, const char* tag, void *data void IXmlOutputInitTypeValue(IXmlOutputState_t *state, const char* tag, uint8 value) { char buf[80]; - FormatInitType(buf, (IB_PORT_INIT_TYPE)value); + + snprintf(buf, 80, "%s%s%s%s", + value & PORT_INIT_TYPE_NOLOAD?"NL ": "", + value & PORT_INIT_TYPE_PRESERVE_CONTENT?"PC ": "", + value & PORT_INIT_TYPE_PRESERVE_PRESENCE?"PP ": "", + value & PORT_INIT_TYPE_DO_NOT_RESUSCITATE?"NR ": ""); + IXmlOutputStrUint(state, tag, buf, value); } @@ -859,72 +865,6 @@ void IXmlOutputOptionalTraceRecord(IXmlOutputState_t *state, const char* tag, vo IXmlOutputOptionalStruct(state, tag, data, NULL, XmlTraceRecordFields); } -/****************************************************************************/ -/* PortCounters Input/Output functions */ - -/* bitfields needs special handling: LocalLinkIntegrityErrors */ -static void PortCountersXmlOutputLocalLinkIntegrityErrors(IXmlOutputState_t *state, const char *tag, void *data) -{ - IXmlOutputUint(state, tag, ((PORT_COUNTERS *)data)->LocalLinkIntegrityErrors); -} - -static void PortCountersXmlParserEndLocalLinkIntegrityErrors(IXmlParserState_t *state, const IXML_FIELD *field, void *object, void *parent, XML_Char *content, unsigned len, boolean valid) -{ - uint8 value; - - if (IXmlParseUint8(state, content, len, &value)) - ((PORT_COUNTERS *)object)->LocalLinkIntegrityErrors = value; -} - -/* bitfields needs special handling: ExcessiveBufferOverrunErrors */ -static void PortCountersXmlOutputExcessiveBufferOverrunErrors(IXmlOutputState_t *state, const char *tag, void *data) -{ - IXmlOutputUint(state, tag, ((PORT_COUNTERS *)data)->ExcessiveBufferOverrunErrors); -} - -static void PortCountersXmlParserEndExcessiveBufferOverrunErrors(IXmlParserState_t *state, const IXML_FIELD *field, void *object, void *parent, XML_Char *content, unsigned len, boolean valid) -{ - uint8 value; - - if (IXmlParseUint8(state, content, len, &value)) - ((PORT_COUNTERS *)object)->ExcessiveBufferOverrunErrors = value; -} - -IXML_FIELD PortCountersFields[] = { - { tag:"PortSelect", format:'H', IXML_FIELD_INFO(PORT_COUNTERS, PortSelect) }, - { tag:"CounterSelect", format:'H', IXML_FIELD_INFO(PORT_COUNTERS, CounterSelect.AsUint16) }, - { tag:"SymbolErrorCounter", format:'U', IXML_FIELD_INFO(PORT_COUNTERS, SymbolErrorCounter) }, - { tag:"LinkErrorRecoveryCounter", format:'U', IXML_FIELD_INFO(PORT_COUNTERS, LinkErrorRecoveryCounter) }, - { tag:"LinkDownedCounter", format:'U', IXML_FIELD_INFO(PORT_COUNTERS, LinkDownedCounter) }, - { tag:"PortRcvErrors", format:'U', IXML_FIELD_INFO(PORT_COUNTERS, PortRcvErrors) }, - { tag:"PortRcvRemotePhysicalErrors", format:'U', IXML_FIELD_INFO(PORT_COUNTERS, PortRcvRemotePhysicalErrors) }, - { tag:"PortRcvSwitchRelayErrors", format:'U', IXML_FIELD_INFO(PORT_COUNTERS, PortRcvSwitchRelayErrors) }, - { tag:"PortXmitDiscards", format:'U', IXML_FIELD_INFO(PORT_COUNTERS, PortXmitDiscards) }, - { tag:"PortXmitConstraintErrors", format:'U', IXML_FIELD_INFO(PORT_COUNTERS, PortXmitConstraintErrors) }, - { tag:"PortRcvConstraintErrors", format:'U', IXML_FIELD_INFO(PORT_COUNTERS, PortRcvConstraintErrors) }, - { tag:"LocalLinkIntegrityErrors", format:'K', format_func:PortCountersXmlOutputLocalLinkIntegrityErrors, end_func:PortCountersXmlParserEndLocalLinkIntegrityErrors }, // bitfield - { tag:"ExcessiveBufferOverrunErrors", format:'K', format_func:PortCountersXmlOutputExcessiveBufferOverrunErrors, end_func:PortCountersXmlParserEndExcessiveBufferOverrunErrors }, // bitfield - { tag:"VL15Dropped", format:'U', IXML_FIELD_INFO(PORT_COUNTERS, VL15Dropped) }, - { tag:"PortXmitData", format:'U', IXML_FIELD_INFO(PORT_COUNTERS, PortXmitData) }, - { tag:"PortRcvData", format:'U', IXML_FIELD_INFO(PORT_COUNTERS, PortRcvData) }, - { tag:"PortXmitPkts", format:'U', IXML_FIELD_INFO(PORT_COUNTERS, PortXmitPkts) }, - { tag:"PortRcvPkts", format:'U', IXML_FIELD_INFO(PORT_COUNTERS, PortRcvPkts) }, - { NULL } -}; - -void PortCountersXmlOutput(IXmlOutputState_t *state, const char *tag, void *data) -{ - IXmlOutputStruct(state, tag, (PORT_COUNTERS*)data, NULL, PortCountersFields); -} - -// only output if value != NULL -void PortCountersXmlOutputOptional(IXmlOutputState_t *state, const char *tag, void *data) -{ - IXmlOutputOptionalStruct(state, tag, (PORT_COUNTERS*)data, NULL, PortCountersFields); -} - -/* caller must supply a PortCountersXmlParserEnd function */ - #if !defined(VXWORKS) || defined(BUILD_DMC) /****************************************************************************/ /* IocService Input/Output functions */ diff --git a/Xml/ixml_ib.h b/Xml/ixml_ib.h index 1f49acb2..cc94ff89 100644 --- a/Xml/ixml_ib.h +++ b/Xml/ixml_ib.h @@ -136,11 +136,6 @@ extern void IXmlOutputOptionalPathRecord(IXmlOutputState_t *state, const char* t extern void IXmlOutputTraceRecord(IXmlOutputState_t *state, const char* tag, void *data); extern void IXmlOutputOptionalTraceRecord(IXmlOutputState_t *state, const char* tag, void *data); -extern IXML_FIELD PortCountersFields[]; -extern void PortCountersXmlOutput(IXmlOutputState_t *state, const char *tag, void *data/*PORT_COUNTERS* */); -extern void PortCountersXmlOutputOptional(IXmlOutputState_t *state, const char *tag, void *data/*PORT_COUNTERS* */); -/* caller must supply PortCountersXmlParserStart and PortCountersXmlParserEnd */ - extern IXML_FIELD IocServiceFields[]; extern void IocServiceXmlOutput(IXmlOutputState_t *state, const char *tag, void *data/*IOC_SERVICE*/); extern void IocServiceXmlOutputOptional(IXmlOutputState_t *state, const char *tag, void *data/*IOC_SERVICE*/); diff --git a/buildFeatureDefs b/buildFeatureDefs new file mode 100644 index 00000000..e69de29b diff --git a/opa-fm.spec.in b/opa-fm.spec.in index f409549b..bab32a0d 100644 --- a/opa-fm.spec.in +++ b/opa-fm.spec.in @@ -29,8 +29,8 @@ #[ICS VERSION STRING: unknown] Name: opa-fm -Version: 10.5.1.0 -Release: 1%{?dist} +Version: 10.6.0.0 +Release: 132%{?dist} Summary: Intel Omni-Path Fabric Management Software License: GPLv2 or BSD @@ -64,7 +64,7 @@ Fabric Executive, and some fabric management tools. %build cd Esm -./fmbuild -V %{version}.%{release} +./fmbuild $BUILD_ARGS %install BUILDDIR=%{_builddir} DESTDIR=%{buildroot} LIBDIR=%{_libdir} RPM_INS=n ./Esm/fm_install.sh diff --git a/opamgt/Makefile b/opamgt/Makefile index 049c8039..351392d7 100644 --- a/opamgt/Makefile +++ b/opamgt/Makefile @@ -52,6 +52,7 @@ CFILES = \ src/opamgt.c \ src/opamgt_pa.c \ src/opamgt_sa.c \ + src/opamgt_sa_notice.c \ src/opamgt_sa_query.c \ src/omgt_oob_connections.c \ src/omgt_oob_net.c \ @@ -80,7 +81,8 @@ INCLUDE_TARGETS = \ src/stl_convertfuncs.h \ include/public/opamgt.h \ include/public/opamgt_pa.h \ - include/public/opamgt_sa.h \ + include/public/opamgt_sa.h \ + include/public/opamgt_sa_notice.h \ include/opamgt_dump_mad.h \ include/opamgt_priv.h \ include/opamgt_pa_priv.h \ @@ -94,10 +96,13 @@ SAMPLE_TARGETS = \ samples/saquery.c \ samples/paquery.c \ samples/simple_sa_query.c \ - samples/simple_pa_query.c + samples/simple_sa_notice.c \ + samples/simple_pa_query.c \ + samples/job_schedule.c \ + samples/show_switch_cost_matrix.c # Non-compiled files -MISC_FILES = +MISC_FILES = version # all source files SOURCES = $(CFILES) $(CCFILES) $(LFILES) $(RSCFILES) $(IDLFILE) # Source files to include in DSP File @@ -186,8 +191,10 @@ include $(TL_DIR)/Makerules/Maketargets.install STAGE:: ifeq "$(PRODUCT)" "OPENIB_FF" $(VS)$(STAGE_INSTALL) $(STAGE_INSTALL_DIR_OPT) $(PROJ_STAGE_LIB_DIR) $(CMD_TARGETS_SHLIB) - $(VS)$(STAGE_INSTALL) $(STAGE_INSTALL_DIR_OPT) $(PROJ_STAGE_OPAMGT_DIR) $(INCLUDE_TARGETS) - $(VS)$(STAGE_INSTALL) $(STAGE_INSTALL_DIR_OPT) $(PROJ_STAGE_OPAMGT_DIR) $(SAMPLE_TARGETS) + $(VS)$(STAGE_INSTALL) $(STAGE_INSTALL_DIR_OPT) $(PROJ_STAGE_OPAMGT_DIR) \ + $(INCLUDE_TARGETS) \ + $(SAMPLE_TARGETS) \ + $(MISC_FILES) endif # Unit test execution diff --git a/opamgt/include/opamgt_pa_priv.h b/opamgt/include/opamgt_pa_priv.h index 86c77260..3d14a41d 100644 --- a/opamgt/include/opamgt_pa_priv.h +++ b/opamgt/include/opamgt_pa_priv.h @@ -39,16 +39,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include "opamgt_priv.h" -#include +#include #include #define PA_REQ_HEADER_SIZE (sizeof(MAD_COMMON) + sizeof(SA_MAD_HDR)) - -#define PACLIENT_UNKNOWN 0 -#define PACLIENT_OPERATIONAL 1 -#define PACLIENT_DOWN (-1) -#define PACLIENT_INVALID_PARAM (-2) /** * @brief PA query input type to string * @param code Input type code value @@ -81,7 +76,7 @@ iba_pa_query_result_type_msg( * PACLIENT_DOWN - initialization not successful/PaServer not available */ int -omgt_pa_client_connect( +omgt_pa_service_connect( struct omgt_port *port ); diff --git a/opamgt/include/opamgt_priv.h b/opamgt/include/opamgt_priv.h index 375a464c..b1edae27 100644 --- a/opamgt/include/opamgt_priv.h +++ b/opamgt/include/opamgt_priv.h @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "opamgt.h" #include "iba/ib_types.h" - +#include "iba/ib_generalServices.h" #ifndef OMGT_OUTPUT_ERROR #define OMGT_OUTPUT_ERROR(port, format, args...) \ @@ -409,6 +409,7 @@ FSTATUS omgt_mad_refresh_port_details(struct omgt_port *port); * Generic HELPER FUNCTIONs */ + /** * @brief Get the HFI number * diff --git a/opamgt/include/opamgt_sa_priv.h b/opamgt/include/opamgt_sa_priv.h index cbf92133..1a9ff949 100644 --- a/opamgt/include/opamgt_sa_priv.h +++ b/opamgt/include/opamgt_sa_priv.h @@ -35,18 +35,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "opamgt_priv.h" #include -#define OPAMGT_DEFAULT_PORT_NUM 1 - -struct ibv_sa_event { - void *context; - int status; - int attr_count; - int attr_size; - int attr_offset; - uint16_t attr_id; - void *attr; -}; - /* * Convert old QUERY_INPUT_VALUE to new OMGT_QUERY_INPUT_VALUE * @@ -82,103 +70,6 @@ FSTATUS omgt_query_sa(struct omgt_port *port, */ void omgt_free_query_result_buffer(IN void * pQueryResult); -/** - * Initiates a registration for the specified trap. - * - * @param port port opened by omgt_open_port_* - * @param trap_num The trap number to register for - * @param context optional opaque info - * - * @return 0 if success, else error code - */ -FSTATUS omgt_sa_register_trap(struct omgt_port *port, - uint16_t trap_num, - void *context); - -/** - * Unregisters for the specified trap. - * - * @param port port opened by omgt_open_port_* - * @param trap_num The trap number to unregister - * - * @return 0 if success, else error code - */ -FSTATUS omgt_sa_unregister_trap(struct omgt_port *port, uint16_t trap_num); - -/** - * Fetches the next available notice. Blocks in kernel (interrupted on - * process signal). - * - * @param port port opened by omgt_open_port_* - * @param target_buf Pointer to buffer to place notice into - * @param buf_size Size of the target buffer - * @param bytes_written OUTPUT: Set to the number of bytes written - * written into the buffer - * - * @return 0 if success, else error code - */ -FSTATUS omgt_sa_get_event(struct omgt_port *port, void *target_buf, - size_t buf_size, int *bytes_written); - -/** - * Set the buffer counts for QP creation. - * - * This function must be called after omgt_open_port but - * before omgt_sa_register_trap. - * - * @param port port opened by omgt_open_port_* - * @param send_count number of send buffers to use on port (0 for no change) - * @param recv_count number of receive buffers to use on port (0 for no change) - * - * @return 0 if success, else error code - */ -FSTATUS omgt_set_sa_buf_cnt(struct omgt_port *port, - int send_count, - int recv_count); - -/** - * Get the buffer counts for QP creation. - * - * @param port port opened by omgt_open_port_* - * @param send_count number of send buffers used on port - * @param recv_count number of receive buffers used on port - * - * @return 0 if success, else error code - */ -FSTATUS omgt_get_sa_buf_cnt(struct omgt_port *port, - int *send_count, - int *recv_count); - -/** - * Retrieves the next pending event, if no event is pending - * blocks waiting for an event. - * - * @param port port opened by omgt_open_port_* - * @param event Allocated information about the next event. - * - * @return 0 if success, else error code - */ -FSTATUS omgt_get_sa_event(struct omgt_port *port, struct ibv_sa_event **event); - -/** - * Cleans up allocated ibv_sa_event structure. - * - * @param event Allocated information about the next event. - * - * @return 0 if success, else error code - */ -FSTATUS omgt_ack_sa_event(struct ibv_sa_event *event); - -/** - * Retrieves the next pending event, if no event is pending - * waits for an event. - * - * @param port port opened by omgt_open_port_* - * @param event Allocated information about the next event. - * - * @return 0 if success, else error code - */ -int ibv_sa_get_event(struct omgt_port *port, struct ibv_sa_event **event); #endif // __OPAMGT_PRIV_SA_H__ diff --git a/opamgt/include/public/opamgt.h b/opamgt/include/public/opamgt.h index 6bf05b0d..f60feeb7 100644 --- a/opamgt/include/public/opamgt.h +++ b/opamgt/include/public/opamgt.h @@ -73,11 +73,16 @@ typedef uint32_t OMGT_STATUS_T; struct omgt_port; #define OMGT_DBG_FILE_SYSLOG ((FILE *)-1) +#define OMGT_DEF_TIMEOUT_MS 1000 +#define OMGT_DEF_RETRY_CNT 3 /** * @brief Configuration settings used when opening an omgt_port * - * Configuration options are passed to omgt_port open functions. Current - * capabilility of settings is limited to configuring logging. + * Optional advanced configuration options than can be passed to omgt_port open + * functions. + * + * Current default values when NULL pointer is passed to open functions is NULL, + * meaning error and debug logging are disabled. * * error_file and debug_file can be specified as either an open linux FILE, or * can use the following special values: @@ -145,7 +150,8 @@ struct omgt_oob_input { * @param hfi_name HFI device name (e.g. "hfi1_0") * @param port_num port number of the hfi starting at 1 (0 is a * wildcard meaning first active) - * @param session_params Parameters to open port with (e.g. Logging streams) + * @param session_params Optional advanced parameters to open port with (e.g. + * Logging streams). * * @return OMGT_STATUS_T * @@ -166,7 +172,8 @@ OMGT_STATUS_T omgt_open_port(struct omgt_port **port, char *hfi_name, uint8_t po * at 1 (0 is a wildcard meaning first active) * @param port_num port number of the hfi starting at 1 (0 is a * wildcard meaning first active) - * @param session_params Parameters to open port with (e.g. Logging streams) + * @param session_params Optional advanced parameters to open port with (e.g. + * Logging streams). * * @return OMGT_STATUS_T * @@ -184,7 +191,8 @@ OMGT_STATUS_T omgt_open_port_by_num(struct omgt_port **port, int32_t hfi_num, ui * * @param port port object is allocated and returned * @param port_guid port GUID of the port - * @param session_params Parameters to open port with (e.g. Logging streams) + * @param session_params Optional advanced parameters to open port with (e.g. + * Logging streams). * * @return OMGT_STATUS_T * @@ -202,7 +210,8 @@ OMGT_STATUS_T omgt_open_port_by_guid(struct omgt_port **port, uint64_t port_guid * * @param port port object is allocated and returned * @param oob_input OOB conection info - * @param session_params Parameters to open port with (e.g. Logging streams) + * @param session_params Optional advanced parameters to open port with (e.g. + * Logging streams). * * @return OMGT_STATUS_T * @@ -263,6 +272,38 @@ void omgt_set_dbg(struct omgt_port *port, FILE *file); */ void omgt_set_err(struct omgt_port *port, FILE *file); +/** + * @brief Set query timeout for an opamgt port + * + * Allows Dynamic modification of the query timeout value. Timeout value is + * initially set to OMGT_DEF_TIMEOUT_MS during port open and can be changed + * at any time with this function. + * + * @param port port instance to modify configuration. + * @param ms_timeout timeout value in milliseconds (ms). An invalid timeout + * value will reset timeout to default. Default timeout is + * 1000 ms or 1 second. + * + * @see omgt_params + * @see OMGT_DEF_TIMEOUT_MS + */ +void omgt_set_timeout(struct omgt_port *port, int ms_timeout); + +/** + * @brief Set query retry count for an opamgt port + * + * Allows Dynamic modification of the query retry value. Retry value is + * initially set to OMGT_DEF_RETRY_CNT during port open and can be changed + * at any time with this function. + * + * @param port port instance to modify configuration. + * @param retry_count Number of times to retry query. An invalid retry count + * will reset to default. Default is 3. + * + * @see omgt_params + * @see OMGT_DEF_RETRY_CNT + */ +void omgt_set_retry_count(struct omgt_port *port, int retry_count); /** ============================================================================ * omgt_port accessor functions for use while in in-band mode @@ -336,6 +377,53 @@ OMGT_STATUS_T omgt_port_get_port_state(struct omgt_port *port, uint8_t *port_sta OMGT_STATUS_T omgt_port_get_hfi_name(struct omgt_port *port, char hfi_name[IBV_SYSFS_NAME_MAX]); +/* OMGT Service State Values */ +#define OMGT_SERVICE_STATE_UNKNOWN 0 +#define OMGT_SERVICE_STATE_OPERATIONAL 1 +#define OMGT_SERVICE_STATE_DOWN (-1) +#define OMGT_SERVICE_STATE_UNAVAILABLE (-2) + +/* OMGT refresh values for how to get or update a service's state */ +#define OMGT_REFRESH_SERVICE_NOP 0x00000000 /* Do not refresh */ +#define OMGT_REFRESH_SERVICE_BAD_STATE 0x00000001 /* Only Refresh if state is not Operational */ +#define OMGT_REFRESH_SERVICE_ANY_STATE 0x00000002 /* Refresh on any state */ + +/** + * @brief Gets port's SA Service's State. + * + * Get the Port's SA Service State. If refresh is triggered, this function will + * send an SA ClassPortInfo query with a small timeout value to quickly check + * the responsiveness of the SA. This get function is an alternative way to + * initialize the port's SA Service State. The SA Service State is also updated + * or initialized before an SA query when the state is not operational. + * + * @param port previously initialized port object for an in-band + * connection + * @param sa_service_state SA Service State to be returned + * @param refresh value to possibly trigger a refresh + * @return OMGT_STATUS_T + */ +OMGT_STATUS_T omgt_port_get_sa_service_state(struct omgt_port *port, int *sa_service_state, uint32_t refresh); +/** + * @brief Gets port's PA Client State. + * + * Get the Port's PA Service State. If refresh is triggered, this function will + * attempt to find the PA's Service record using an SA query to quickly check + * the responsiveness and presence of the PA. An Additional SA Path Record query + * will be issued to determine how to route to the PA. This get function is an + * alternative way to initialize the port's PA Service State. The PA Service + * State is also updated or initialized before a PA query when the state is not + * operational. + * + * @param port previously initialized port object for an in-band + * connection + * @param pa_service_state PA Service State to be returned + * @param refresh value to possibly trigger a refresh + * + * @return OMGT_STATUS_T + */ +OMGT_STATUS_T omgt_port_get_pa_service_state(struct omgt_port *port, int *pa_service_state, uint32_t refresh); + /** ============================================================================ * omgt_port accessor functions for use while in out-of-band mode * @@ -412,7 +500,23 @@ OMGT_STATUS_T omgt_port_get_ip_addr_text(struct omgt_port *port, char buf[], siz */ OMGT_STATUS_T omgt_get_hfi_names(char hfis[][UMAD_CA_NAME_LEN], int32_t max, int32_t *hfi_count); -#ifdef __cpluspluc +/** + * @brief Converts the service state to text + * + * @param service_state value to convert to text + * + * @return const char* + */ +const char* omgt_service_state_totext(int service_state); +/** + * @brief Converts the status value to text + * + * @param status OMGT_STATUS_T value to convert to text + * + * @return const char* + */ +const char* omgt_status_totext(OMGT_STATUS_T status); +#ifdef __cplusplus } #endif diff --git a/opamgt/include/public/opamgt_pa.h b/opamgt/include/public/opamgt_pa.h index 102201e0..34a843de 100644 --- a/opamgt/include/public/opamgt_pa.h +++ b/opamgt/include/public/opamgt_pa.h @@ -37,7 +37,7 @@ extern "C" { #endif //opamgt includes -#include +#include #include "opamgt.h" diff --git a/opamgt/include/public/opamgt_sa.h b/opamgt/include/public/opamgt_sa.h index d323800c..a4fde54a 100644 --- a/opamgt/include/public/opamgt_sa.h +++ b/opamgt/include/public/opamgt_sa.h @@ -255,7 +255,8 @@ omgt_sa_get_nodedesc_records( * @param selector Criteria to select records. * Valid InputType values: * NoInput, PortGuid, PortGid, PortGuidPair, GidPair, - * PathRecord, Lid, PKey, SL, ServiceId + * PathRecord, PortGuidList, GidList, Lid, + * PKey, SL, ServiceId * @note * A sourcegid is always required with this query * @@ -495,6 +496,28 @@ omgt_sa_get_scvlt_table_records( ); +/** + * @brief Query SA for SCVLnt Table Records + * + * @param port port opened by omgt_open_port_* + * @param selector Criteria to select records. + * Valid InputType values: + * NoInput, Lid + * @param num_records Output: The number of records returned in query + * @param records Output: Pointer to records. + * Must be freed by calling omgt_sa_free_records + * + *@return OMGT_STATUS_SUCCESS if success, else error code + */ +OMGT_STATUS_T +omgt_sa_get_scvlnt_table_records( + struct omgt_port *port, + omgt_sa_selector_t *selector, + int32_t *num_records, + STL_SC2PVL_NT_MAPPING_TABLE_RECORD **records + ); + + /** * @brief Query SA for SwitchInfo Records * @@ -876,6 +899,29 @@ omgt_sa_get_portgroupfwd_records( ); + +/** + * @brief Query SA for SwitchCost Records + * + * @param port port opened by omgt_open_port_* + * @param selector Criteria to select records. + * Valid InputType values: + * NoInput, Lid + * @param num_records Output: The number of records returned in query + * @param records Output: Pointer to records. + * Must be freed by calling omgt_sa_free_records + * + * @return OMGT_STATUS_SUCCESS if success, else error code + */ +OMGT_STATUS_T +omgt_sa_get_switchcost_records( + struct omgt_port *port, + omgt_sa_selector_t *selector, + int32_t *num_records, + STL_SWITCH_COST_RECORD **records + ); + + #ifdef __cplusplus } #endif diff --git a/opamgt/include/public/opamgt_sa_notice.h b/opamgt/include/public/opamgt_sa_notice.h new file mode 100644 index 00000000..8c94672d --- /dev/null +++ b/opamgt/include/public/opamgt_sa_notice.h @@ -0,0 +1,92 @@ +/* BEGIN_ICS_COPYRIGHT2 **************************************** + +Copyright (c) 2015, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +** END_ICS_COPYRIGHT2 ****************************************/ + +/* [ICS VERSION STRING: unknown] */ + +#ifndef __OPAMGT_NOTICE_H__ +#define __OPAMGT_NOTICE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/** + * @brief Initiates a registration for the specified trap. + * + * @param port Previously initialized port object for an in-band + * connection. + * @param trap_num Trap Number to resgister for. + * @param context optional opaque info to be retruned when trap is recieved. + * + * @return OMGT_STATUS_T + */ +OMGT_STATUS_T omgt_sa_register_trap(struct omgt_port *port, uint16_t trap_num, + void *context); + +/** + * @brief Unregisters for the specified trap. + * + * @param port Previously initialized port object for an in-band + * connection. + * @param trap_num Trap Number to unresgister. + * + * @return OMGT_STATUS_T + */ +OMGT_STATUS_T omgt_sa_unregister_trap(struct omgt_port *port, uint16_t trap_num); + +/** + * @brief Gets the Notice Report forwarded from the SM + * + * @param port Previously initialized port object for an in-band + * connection. + * @param notice Pointer to Notice structure that is allocate and + * returned. Must be freed by user. + * @param notice_len pointer to length of Notice structure to be returned. + * Length should always be greater than or equal to the + * sizeof(STL_NOTICE). All bytes that exist greather + * than sizeof(STL_NOTICE) are for ClassData (i.e. + * ClassData Length = notice_len - sizeof(STL_NOTICE)). + * @param context pointer to registration context value returned. + * @param poll_timeout_ms Length of time this function will poll (wait) for a + * Notice Report to be received in milliseconds (-1 will + * block indefinitely, 0 will not block, and X > 0 will + * block for X). + * + * @return OMGT_STATUS_T + */ +OMGT_STATUS_T omgt_sa_get_notice_report(struct omgt_port *port, STL_NOTICE **notice, + size_t *notice_len, void **context, int poll_timeout_ms); + +#ifdef __cplusplus +} +#endif +#endif /* __OPAMGT_NOTICE_H__ */ diff --git a/opamgt/samples/README b/opamgt/samples/README index 977dcd39..ac676c5e 100644 --- a/opamgt/samples/README +++ b/opamgt/samples/README @@ -5,3 +5,18 @@ Use 'make ' to just build a single application where is one of the sources in this directory without a '.c' suffix, e.g. saquery Use 'make clean' to remove all compiled applications + +applications: +simple_sa_query - A 'hello world' of how to query an OPA SA +saquery - A sample showing all requests for subnet management information stored in an OPA SA + +simple_pa_query - A 'hello world' of how to query an OPA PA +paquery - A sample showing all requests for performance management information stored in an OPA PA + +simple_sa_notice - A 'hello world' of how to subscribe to fabric notifications + +show_switch_cost_matrix - A sample showing how to request the cost data an OPA FM uses to make routing decisions +job_schedule - A sample showing how to determine fabric topology and schedule a 'job' or request a number of + nodes based on that topology. + + diff --git a/opamgt/samples/job_schedule.c b/opamgt/samples/job_schedule.c new file mode 100644 index 00000000..71ee8dd2 --- /dev/null +++ b/opamgt/samples/job_schedule.c @@ -0,0 +1,310 @@ +/* This sample demonstrates the use of the SA swcost query + * to select a set of nodes/switches for a job + * + */ +// core API +#include +// swcost query +#include + +// "Edge" Switch +typedef struct { + STL_LID lid; // identify switches by LID. Easiest when using cost records + STL_NODE_RECORD *nodes [48]; // list of hosts attached to this switch + int last_host_index; // index in previous list of last host +} opa_switch; + + +/* Helper function to retrieve the LID + * of the neighbor of the supplied node + * Used to determine edge switches, those with hosts attached + */ +STL_LID get_neighbor (STL_NODE_RECORD *node_record, STL_LINK_RECORD *link_records, int num_link_records) +{ + STL_LID lid1, lid2; + int i; + for (i = 0; i < num_link_records; ++i) { + STL_LINK_RECORD *link_record = &link_records[i]; + lid1 = link_record->RID.FromLID; + lid2 = link_record->ToLID; + + if (node_record->RID.LID == lid1) { + return lid2; + } else if (node_record->RID.LID == lid2) { + return lid1; + } + } + + return -1; +} + +/* Helper function to determine if list of lids contains + * a specific lid + * */ +int contains (STL_LID * array, STL_LID lid, int array_size) +{ + int i; + for (i = 0; i < array_size; ++i){ + if (array[i] == lid) return 1; + } + return 0; +} + +int main(int argc, char **argv) +{ + OMGT_STATUS_T status = OMGT_STATUS_SUCCESS; + int exitcode = 0; + + struct omgt_port *port = NULL; + int num_host_records, num_link_records, num_cost_records, num_fabricinfo_records, num_classportinfo_records; + + STL_LINK_RECORD *link_records; + STL_NODE_RECORD *host_records; + STL_FABRICINFO_RECORD *fabricinfo_records; + STL_SWITCH_COST_RECORD *cost_records = NULL; + STL_CLASS_PORT_INFO *classportinfo_records = NULL; + + opa_switch *edge_switches; + opa_switch **used_switches; + STL_LID *visited_switch_lids; + + + int last_switch_index = 0; + int i, j; + int requested_hosts = 0, hosts_needed = 0; + int DEBUG = 0; //set to turn on some additional output + + if (argc > 1) { + requested_hosts = strtoul(argv[1], NULL, 0); + if (DEBUG) printf("Requested Hosts: %u\n", requested_hosts); + } else { + fprintf(stderr, "Usage: %s \n", argv[0]); + exitcode = 1; + goto done; + } + + // create a session + status = omgt_open_port_by_num(&port, 1, 1, NULL); + if (OMGT_STATUS_SUCCESS != status) { + fprintf(stderr, "failed to open port\n"); + exitcode = 1; + goto done; + } + + omgt_sa_selector_t selector; + selector.InputType = InputTypeNoInput; + + /* Initial set-up, request topology information from SA + * + * We request FabricInfo, Link, and (HFI) Node records. + */ + status = omgt_sa_get_fabric_info_records(port, &selector, &num_fabricinfo_records, &fabricinfo_records); + if (OMGT_STATUS_SUCCESS != status || num_fabricinfo_records < 1) { + fprintf(stderr, "failed to get fabricinfo. MADStatus=0x%x\n", omgt_get_sa_mad_status(port)); + exitcode = 1; + goto cleanup; + } + + edge_switches = malloc(sizeof(opa_switch) * fabricinfo_records[0].NumSwitches); // list of switches with hosts + used_switches = malloc(sizeof(opa_switch *) * fabricinfo_records[0].NumSwitches); // list of switches used in job + visited_switch_lids = malloc(sizeof(STL_LID) * fabricinfo_records[0].NumSwitches); // list of switch lids visited during cost decisions + + if (!edge_switches || !used_switches || ! visited_switch_lids){ + fprintf(stderr, "failed to allocate memory.\n"); + exitcode = 1; + goto cleanup; + } + + status = omgt_sa_get_link_records(port, &selector, &num_link_records, &link_records); + if (OMGT_STATUS_SUCCESS != status) { + fprintf(stderr, "failed to execute link record query. MADStatus=0x%x\n", omgt_get_sa_mad_status(port)); + exitcode = 1; + goto cleanup; + } + + selector.InputType = InputTypeNodeType; // select records by type + selector.InputValue.NodeRecord.NodeType = IBA_NODE_CHANNEL_ADAPTER; // select only HFIs (Channel Adapter) + status = omgt_sa_get_node_records(port, &selector, &num_host_records, &host_records); + if (OMGT_STATUS_SUCCESS != status) { + fprintf(stderr, "failed to execute node record query. MADStatus=0x%x\n", omgt_get_sa_mad_status(port)); + exitcode = 1; + goto cleanup; + } + + if (DEBUG) printf("hosts: %u sws: %u\n", fabricinfo_records[0].NumHFIs, fabricinfo_records[0].NumSwitches); + if (requested_hosts > fabricinfo_records[0].NumHFIs) { + fprintf(stderr, "Error: Requested number of hosts exceeds number of hosts available\n"); + exitcode = 1; + goto cleanup; + } + + /* Determine the edge switches in the fabric along with associated hosts*/ + for (i = 0; i < num_host_records; ++i) { + STL_NODE_RECORD *host_record = &host_records[i]; + + STL_LID neighbor_lid = get_neighbor(host_record, link_records, num_link_records); + if (-1 == neighbor_lid){ + fprintf(stderr, "Node missing neighbor\n"); + exitcode = 1; + goto cleanup; + } + int in_list = 0; + int swIndex = 0; + //check if switch in list already + for (j = 0; j < last_switch_index; ++j) { + if (neighbor_lid == edge_switches[j].lid) { + in_list = 1; + swIndex = j; + break; + } + } + if (!in_list) { + edge_switches[last_switch_index++].lid = neighbor_lid; + edge_switches[last_switch_index - 1].nodes[0] = host_record; + + } else { + //add this host to switch's host list + edge_switches[swIndex].nodes[++edge_switches[swIndex].last_host_index] = host_record; + } + } + + if (DEBUG) { + printf("Edge Switches:\n"); + for (i = 0; i < last_switch_index; ++i) { + printf("0x%x\n", edge_switches[i].lid); + for (j = 0; j <= edge_switches[i].last_host_index; ++j) { + printf("---Host %s\n", edge_switches[i].nodes[j]->NodeDesc.NodeString); + } + } + printf("\n\n"); + } + + + /* Determine which hosts to use, attempt to use hosts on a single switch*/ + int max_hosts_switch_index = 0, max_hosts = 0; + for (i = 0; i < last_switch_index; ++i) { + // Save the switch with the max number of hosts for later + // use if we need hosts on multiple switches + if (edge_switches[i].last_host_index > max_hosts) { + max_hosts = edge_switches[i].last_host_index; + max_hosts_switch_index = i; + } + if (edge_switches[i].last_host_index >= requested_hosts - 1) { + printf("Job Plan: \nSwitch %u\n", edge_switches[i].lid); + printf("-----------------------\n"); + for (j = 0; j < requested_hosts; ++j) { + printf("---Host %s\n", edge_switches[i].nodes[j]->NodeDesc.NodeString); + } + goto cleanup; + } + } + + //===================PATH COSTS============================ + /* There were no switches with the requisite number of hosts, + * so use Switch Cost Records to use hosts on least cost + * paths. We must check the capability of the SA before using + * this feature + * + * + * We can request the "full" cost matrix which includes costs + * among all switches (actually only the upper half of the matrix) + * OR + * We can request one row of the cost matrix. In the following we + * request the row corresponding to our previously saved switch. This + * gets us the costs from the saved switch to every other switch + */ + + selector.InputType = InputTypeNoInput; + status = omgt_sa_get_classportinfo_records(port, &selector, &num_classportinfo_records, &classportinfo_records); + if (OMGT_STATUS_SUCCESS != status || num_classportinfo_records != 1) { + fprintf(stderr, "failed to execute classportinfo record query. MADStatus=0x%x\n", omgt_get_sa_mad_status(port)); + exitcode = 1; + goto cleanup; + } + + if (! (classportinfo_records[0].CapMask && STL_SA_CAPABILITY2_SWCOSTRECORD_SUPPORT)) { + fprintf(stderr, "SA does not support switchcost records\n"); + exitcode = 1; + goto cleanup; + } + + selector.InputType = InputTypeLid; // Costs can be looked up by LID + selector.InputValue.SwitchCostRecord.Lid = edge_switches[max_hosts_switch_index].lid; + + status = omgt_sa_get_switchcost_records(port, &selector, &num_cost_records, &cost_records); + if (OMGT_STATUS_SUCCESS != status) { + fprintf(stderr, "failed to execute cost record query. MADStatus=0x%x\n", omgt_get_sa_mad_status(port)); + exitcode = 1; + goto cleanup; + } + + hosts_needed = requested_hosts - (max_hosts + 1); + used_switches[0] = &edge_switches[max_hosts_switch_index]; // keep track of edge switches we're using + STL_LID switch_lid; + visited_switch_lids[0] = used_switches[0]->lid; // keep track of switches we've already considered + int num_switches = 1, num_lids = 1; + while(hosts_needed > 0 && num_switches < last_switch_index) { + int min_cost = -1; + for (i = 0; i < num_cost_records; ++i) { + for (j = 0; j < STL_SWITCH_COST_NUM_ENTRIES; ++j) { + if (((min_cost < 0) || (cost_records[i].Cost[j].value < min_cost)) && + !contains(visited_switch_lids, cost_records[i].Cost[j].DLID, num_lids) && + (cost_records[i].Cost[j].DLID > 0)) { + //we should also check that this is an edge switch, this is done below + min_cost = cost_records[i].Cost[j].value; + switch_lid = cost_records[i].Cost[j].DLID; + } + } + } + + if (min_cost > 0){ + // look up next switch, only include edge switches + for (i = 0; i < last_switch_index; ++i) { + if (edge_switches[i].lid == switch_lid) { + used_switches[num_switches] = &edge_switches[i]; + num_switches++; + + hosts_needed -= (edge_switches[i].last_host_index + 1); + break; + } + } + visited_switch_lids[num_lids] = switch_lid; //mark this switch as visited + num_lids++; + } + } + + if (hosts_needed > 0) { + fprintf(stderr, "Error: Could not allocate job hosts\n"); + exitcode = 1; + goto cleanup; + } + + hosts_needed = requested_hosts; + printf("Job Plan: \n"); + printf("-----------------------\n"); + for (i = 0; i < num_switches; ++i){ + printf("Switch %u\n", used_switches[i]->lid); + for (j = 0; j <= used_switches[i]->last_host_index; ++j) { + printf("---Host %s\n", used_switches[i]->nodes[j]->NodeDesc.NodeString); + if (--hosts_needed <= 0) goto cleanup; + } + } + + +cleanup: + if (edge_switches) free(edge_switches); + if (used_switches) free(used_switches); + if (visited_switch_lids) free(visited_switch_lids); + + // free our result buffers + if (fabricinfo_records) omgt_sa_free_records(fabricinfo_records); + if (classportinfo_records) omgt_sa_free_records(classportinfo_records); + if (cost_records) omgt_sa_free_records(cost_records); + if (host_records) omgt_sa_free_records(host_records); + + // close our session + omgt_close_port(port); + +done: + return exitcode; +} diff --git a/opamgt/samples/paquery.c b/opamgt/samples/paquery.c index 785f69d4..6ea4e327 100644 --- a/opamgt/samples/paquery.c +++ b/opamgt/samples/paquery.c @@ -13,17 +13,18 @@ void Usage(void) { - fprintf(stderr, "Usage:paquery [-v] [-h hfi] [-p port] -o type [-g groupName] [-l nodeLid]\n"); - fprintf(stderr, " [-b oob_host] [-P portNumber] [-d] [-U]\n"); - fprintf(stderr, " [-f focus] [-S start] [-r range] [-n imgNum]\n"); - fprintf(stderr, " [-O imgOff] [-y imgTime] [-m moveImgNum] [-M moveImgOff]\n"); - fprintf(stderr, " [-V vfName]\n"); + fprintf(stderr, "Usage:paquery [-v] [-h hfi] [-p port] [-t ms] [-b oob_host] -o type\n"); + fprintf(stderr, " [-g groupName] [-l nodeLid] [-P portNumber] [-d] [-U]\n"); + fprintf(stderr, " [-f focus] [-S start] [-r range] [-n imgNum]\n"); + fprintf(stderr, " [-O imgOff] [-y imgTime] [-m moveImgNum] [-M moveImgOff]\n"); + fprintf(stderr, " [-V vfName]\n"); fprintf(stderr, " --help - display this help text\n"); fprintf(stderr, " -v/--verbose - verbose output\n"); fprintf(stderr, " -h/--hfi hfi - hfi, numbered 1..n, 0= -p port will be a system wide\n"); fprintf(stderr, " port num (default is 0)\n"); fprintf(stderr, " -p/--port port - port, numbered 1..n, 0=1st active (default is 1st\n"); fprintf(stderr, " active)\n"); + fprintf(stderr, " -t/--timeout - timeout in ms\n"); fprintf(stderr, " -b oob_host - perform out of band query. For this example, oob_host\n"); fprintf(stderr, " should have format hostname[:port] or a.b.c.d[:port]\n"); fprintf(stderr, " -o/--output - output type, default is groupList\n"); @@ -163,6 +164,7 @@ struct option options[] = { { "verbose", required_argument, NULL, 'v' }, { "hfi", required_argument, NULL, 'h' }, { "port", required_argument, NULL, 'p' }, + { "timeout", required_argument, NULL, 't' }, { "lid", required_argument, NULL, 'l' }, { "groupName", required_argument, NULL, 'g' }, @@ -191,6 +193,7 @@ int main(int argc, char **argv) int exitcode = 0; struct omgt_port * port = NULL; int i,c,index; + int pa_service_state = OMGT_SERVICE_STATE_UNKNOWN; uint32_t num_data; int debug = 0; @@ -198,6 +201,7 @@ int main(int argc, char **argv) char * type = "groupList"; int hfi_num = 1; int port_num = 1; + int ms_timeout = OMGT_DEF_TIMEOUT_MS; char * oob_addr = NULL; int select,start,range; @@ -212,17 +216,20 @@ int main(int argc, char **argv) STL_PA_IMAGE_ID_DATA response_id; STL_PA_IMAGE_ID_DATA image_id_move = {0}; - while (-1 != (c = getopt_long(argc, argv, "h:p:o:l:P:n:g:dUO:y:m:M:f:S:r:V:b:v$", options, &index))){ + while (-1 != (c = getopt_long(argc, argv, "h:p:t:o:l:P:n:g:dUO:y:m:M:f:S:r:V:b:v$", options, &index))){ switch (c) { case '$': Usage(); break; case 'h': - hfi_num = strtoul(optarg, NULL, 0); + hfi_num = strtol(optarg, NULL, 0); break; case 'p': - port_num = strtoul(optarg, NULL, 0); + port_num = strtol(optarg, NULL, 0); + break; + case 't': + ms_timeout = strtol(optarg, NULL, 0); break; case 'o': type = optarg; @@ -303,14 +310,39 @@ int main(int argc, char **argv) status = omgt_oob_connect(&port, &oob_input, &session_params); } else { status = omgt_open_port_by_num(&port, hfi_num, port_num, &session_params); + + /* (Optional) Check if the PA Service is Operational + * All PA queries will do an initial pa service state check if not already + * operational, so this is more of a verbose sanity check. + */ + if (status == OMGT_STATUS_SUCCESS) { + status = omgt_port_get_pa_service_state(port, &pa_service_state, OMGT_REFRESH_SERVICE_ANY_STATE); + if (status == OMGT_STATUS_SUCCESS) { + if (pa_service_state != OMGT_SERVICE_STATE_OPERATIONAL) { + fprintf(stderr, "failed to connect, PA service state is Not Operational: %s (%d)\n", + omgt_service_state_totext(pa_service_state), pa_service_state); + exitcode = 1; + goto fail2; + } + } else { + fprintf(stderr, "failed to get and refresh PA service state: %s (%u)\n", + omgt_status_totext(status), status); + exitcode = 1; + goto fail2; + } + } } if (OMGT_STATUS_SUCCESS != status){ - fprintf(stderr, "failed to open port\n"); + fprintf(stderr, "failed to open port: %s (%u)\n", + omgt_status_totext(status), status); exitcode=1; goto fail1; } + //set timeout for PA operations + omgt_set_timeout(port, ms_timeout); + void * pa_data; //perform the requested operation if (!strcasecmp(type, "pmconfig")){ diff --git a/opamgt/samples/saquery.c b/opamgt/samples/saquery.c index 1c572e29..29b16369 100644 --- a/opamgt/samples/saquery.c +++ b/opamgt/samples/saquery.c @@ -12,7 +12,7 @@ void Usage() { - fprintf(stdout, "Usage: saquery [-v] [-h hfi] [-p port] [-b oob_host] [-l lid] -o type \n"); + fprintf(stdout, "Usage: saquery [-v] [-h hfi] [-p port] [-t ms] [-b oob_host] [-l lid] -o type \n"); fprintf(stdout, " or\n"); fprintf(stdout, " saquery --help\n"); fprintf(stdout, " --help - produce full help text\n"); @@ -22,6 +22,7 @@ void Usage() fprintf(stderr, " port num (default is 0)\n"); fprintf(stderr, " -p/--port port - port, numbered 1..n, 0=1st active (default is 1st\n"); fprintf(stderr, " active)\n"); + fprintf(stderr, " -t/--timeout - timeout in ms\n"); fprintf(stderr, " -l/--lid - filter query results for specific lid\n"); fprintf(stderr, " -g/--guid - filter query results for specific guid\n"); fprintf(stderr, " -b oob_host - perform out of band query. For this example, oob_host\n"); @@ -81,6 +82,7 @@ struct option options[] = { { "verbose", required_argument, NULL, 'v' }, { "hfi", required_argument, NULL, 'h' }, { "port", required_argument, NULL, 'p' }, + { "timeout", required_argument, NULL, 't' }, // input types (small subset) { "lid", required_argument, NULL, 'l' }, @@ -100,12 +102,14 @@ int main(int argc, char ** argv) struct omgt_port * port = NULL; int num_records = 0; int i, c, index, debug = 0; + int sa_service_state = OMGT_SERVICE_STATE_UNKNOWN; void *sa_records = NULL; omgt_sa_selector_t selector; char * type = "node"; int hfi_num = 1; int port_num = 1; + int ms_timeout = OMGT_DEF_TIMEOUT_MS; uint32_t lid = 0; uint64_t guid = 0; uint64_t local_prefix = 0; @@ -117,28 +121,31 @@ int main(int argc, char ** argv) //default to requesting all records selector.InputType = InputTypeNoInput; - while (-1 != (c = getopt_long(argc, argv, "h:p:o:l:b:g:x:v$", options, &index))){ + while (-1 != (c = getopt_long(argc, argv, "h:p:t:o:l:b:g:x:v$", options, &index))){ switch (c) { case '$': Usage(); break; case 'h': // hfi to issue query from - hfi_num = strtoul(optarg, NULL, 0); + hfi_num = strtol(optarg, NULL, 0); break; case 'p': // port to issue query from - port_num = strtoul(optarg, NULL, 0); + port_num = strtol(optarg, NULL, 0); + break; + case 't': + ms_timeout = strtol(optarg, NULL, 0); break; case 'o': // select output record desired type = optarg; break; case 'l': selector.InputType = InputTypeLid; - lid = strtol(optarg, NULL, 0); + lid = strtoul(optarg, NULL, 0); break; case 'g': selector.InputType = InputTypePortGuid; - guid = strtol(optarg, NULL, 0); + guid = strtoul(optarg, NULL, 0); break; case 'x': gid = optarg; @@ -179,14 +186,39 @@ int main(int argc, char ** argv) status = omgt_open_port_by_num(&port, hfi_num, port_num, &session_params); (void)omgt_port_get_port_guid(port, &local_guid); (void)omgt_port_get_port_prefix(port, &local_prefix); + + /* (Optional) Check if the SA Service is Operational + * All SA queries will do an initial sa service state check if not already + * operational, so this is more of a verbose sanity check. + */ + if (status == OMGT_STATUS_SUCCESS) { + status = omgt_port_get_sa_service_state(port, &sa_service_state, OMGT_REFRESH_SERVICE_ANY_STATE); + if (status == OMGT_STATUS_SUCCESS) { + if (sa_service_state != OMGT_SERVICE_STATE_OPERATIONAL) { + fprintf(stderr, "failed to connect, SA service state is Not Operational: %s (%d)\n", + omgt_service_state_totext(sa_service_state), sa_service_state); + exitcode = 1; + goto fail2; + } + } else { + fprintf(stderr, "failed to get and refresh SA service state: %s (%u)\n", + omgt_status_totext(status), status); + exitcode = 1; + goto fail2; + } + } } if (OMGT_STATUS_SUCCESS != status){ - fprintf(stderr, "failed to open port\n"); + fprintf(stderr, "failed to open port: %s (%u)\n", + omgt_status_totext(status), status); exitcode=1; goto fail1; } + /* Set timeout for SA operation */ + omgt_set_timeout(port, ms_timeout); + /* Perform the requested operation. * Some records are are not always supported, * and in those cases an additional omgt_sa_get_classportinfo @@ -244,14 +276,13 @@ int main(int argc, char ** argv) } else if (!strcmp(type, "path")){ /* Valid Input Types: * NoInput, PortGuid, PortGid, PortGuidPair, GidPair, PathRecord, - * Lid, PKey, SL, ServiceId + * PortGuidList, GidList, Lid, MultiPathRecord, PKey, SourceGid, SL, + * ServiceId * - * SourceGid is not treated as an InputType but is ALWAYS required when querying path/trace records. + * SourceGid is not treated as an InputType but is ALWAYS required when querying path/trace records */ if (selector.InputType == InputTypePortGuid) { selector.InputValue.IbPathRecord.PortGuid.DestPortGuid = guid; - // set source gid. in OoB mode this must be supplied, otherwise - // can be built using the port accessor functions shown above selector.InputValue.IbPathRecord.PortGuid.SourcePortGuid = local_guid; selector.InputValue.IbPathRecord.PortGuid.SharedSubnetPrefix = local_prefix; } else if (selector.InputType == InputTypeLid) { @@ -274,18 +305,6 @@ int main(int argc, char ** argv) /* Valid Input Types: NoInput, PortGid */ status = omgt_sa_get_service_records(port, &selector, &num_records, (IB_SERVICE_RECORD **)&sa_records); } else if (!strcmp(type, "mcmember")){ - // must check if SA supports these records - omgt_sa_selector_t pre_select = {.InputType = InputTypeNoInput}; - status = omgt_sa_get_classportinfo_records(port, &pre_select, &num_records, (STL_CLASS_PORT_INFO **)&sa_records); - - if (OMGT_STATUS_SUCCESS != status || num_records != 1){ - fprintf(stderr, "Failed to determine SA capabilities for mcmember query\n"); - goto fail2; - }else if (! (((STL_CLASS_PORT_INFO **)&sa_records)[0]->CapMask & STL_SA_CAPABILITY_MULTICAST_SUPPORT )){ - fprintf(stderr, "mcmember records not supported by SA\n"); - goto fail2; - } - if (selector.InputType == InputTypeLid) selector.InputValue.IbMcMemberRecord.Lid = lid; status = omgt_sa_get_ib_mcmember_records(port, &selector, &num_records, (IB_MCMEMBER_RECORD **)&sa_records); } else if (!strcmp(type, "inform")){ @@ -293,8 +312,19 @@ int main(int argc, char ** argv) if (selector.InputType == InputTypeLid) selector.InputValue.StlInformInfoRecord.SubscriberLID = lid; status = omgt_sa_get_informinfo_records(port, &selector, &num_records, (STL_INFORM_INFO_RECORD **)&sa_records); } else if (!strcmp(type, "trace")){ + //must check if SA supports these records + omgt_sa_selector_t pre_select = {.InputType = InputTypeNoInput}; + status = omgt_sa_get_classportinfo_records(port, &pre_select, &num_records, (STL_CLASS_PORT_INFO **)&sa_records); + if (OMGT_STATUS_SUCCESS != status || num_records != 1){ + fprintf(stderr, "Failed to determine SA capabilities for trace query\n"); + goto fail2; + }else if (! ((STL_CLASS_PORT_INFO **)&sa_records)[0]->CapMask && STL_SA_CAPABILITY_MULTIPATH_SUPPORT ){ + fprintf(stderr, "trace records not supported by SA\n"); + goto fail2; + } + /* Valid Input Types: PathRecord, PortGuid, GidPair, PortGid */ - /* SourceGid is not treated as an InputType but is ALWAYS required when querying path/trace records. */ + /* SourceGid is not treated as an InputType but is ALWAYS required when querying path/trace records */ if (selector.InputType == InputTypePortGuid) { selector.InputValue.TraceRecord.PortGuid.DestPortGuid = guid; selector.InputValue.TraceRecord.PortGuid.SourcePortGuid = local_guid; @@ -396,8 +426,28 @@ int main(int argc, char ** argv) } - if (OMGT_STATUS_SUCCESS != status){ + if (OMGT_STATUS_SUCCESS != status) { fprintf(stderr, "failed to execute query. MadStatus=0x%x\n", omgt_get_sa_mad_status(port)); + exitcode = 2; + + /* Not used in oob mode */ + if (!oob_addr) { + /* Check if failure was related to SA service state */ + status = omgt_port_get_sa_service_state(port, &sa_service_state, OMGT_REFRESH_SERVICE_NOP); + if (status == OMGT_STATUS_SUCCESS) { + if (sa_service_state != OMGT_SERVICE_STATE_OPERATIONAL) { + fprintf(stderr, "SA service state is Not Operational: %s (%d)\n", + omgt_service_state_totext(sa_service_state), sa_service_state); + exitcode = 1; + goto fail2; + } + } else { + fprintf(stderr, "failed to get SA service state: %s (%u)\n", + omgt_status_totext(status), status); + exitcode = 1; + goto fail2; + } + } } else { printf("Number of records returned: %d\n", num_records); } diff --git a/opamgt/samples/show_switch_cost_matrix.c b/opamgt/samples/show_switch_cost_matrix.c new file mode 100644 index 00000000..b6f5f3f5 --- /dev/null +++ b/opamgt/samples/show_switch_cost_matrix.c @@ -0,0 +1,326 @@ +/* Query SA for Switch Cost Matrix data + * and print it to a file. Monitor for any + * changes and update. + * + */ +// core API +#include +// swcost query +#include +// fabric change notice +#include + +#include + +typedef struct opa_switch{ + STL_LID lid; + const char * name; + struct opa_switch *next; +}opa_switch; + +FILE * matrix_file; + +void free_cost(uint16_t ***cost, int num_rows){ + int i; + + if (!*cost) return; + + for(i = 0; i < num_rows; ++i) { + if ((*cost)[i]) { + free((*cost)[i]); + (*cost)[i] = NULL; + } + } + free(*cost); + *cost = NULL; +} + +void free_switch_list(opa_switch **switchlist_head) +{ + if (!*switchlist_head) return; + opa_switch * temp = *switchlist_head, *temp2; + while(temp){ + temp2 = temp->next; + free(temp); + temp = temp2; + } + *switchlist_head = NULL; +} + +/* Helper function to get the associated name for a particular lid + */ +const char * get_name(STL_LID lid, STL_NODE_RECORD *node_records, int num_node_records) +{ + int i; + for (i = 0; i < num_node_records; ++i) { + if (node_records[i].RID.LID == lid) + return (const char*) node_records[i].NodeDesc.NodeString; + } + return ""; +} + +/* Print Cost Matrix using the Switch Names + */ +void print_matrix(uint16_t **cost, opa_switch *switchlist_head) +{ + fprintf(matrix_file, "%64s", ""); + opa_switch * iter = switchlist_head; + while(iter){ + // Node Descriptions are up to 64 bytes + fprintf(matrix_file, "%64s", iter->name); + iter = iter->next; + } + fprintf(matrix_file, "\n"); + + iter = switchlist_head; + opa_switch * iter2; + while(iter) { + fprintf(matrix_file, "%-64s", iter->name); + iter2 = switchlist_head; + while(iter2) { + if(cost[iter->lid]) + fprintf(matrix_file, "%64d" , cost[iter->lid][iter2->lid]); + iter2 = iter2->next; + } + iter = iter->next; + fprintf(matrix_file, "\n"); + } + fprintf(matrix_file, "\n\n\n"); +} + + +int main(int argc, char **argv) +{ + OMGT_STATUS_T status = OMGT_STATUS_SUCCESS; + int exitcode = 0; + + struct omgt_port *port = NULL; + omgt_sa_selector_t selector; + + int num_classportinfo_records, num_fabricinfo_records, num_cost_records, num_switch_records; + int num_nodes; + + STL_CLASS_PORT_INFO *classportinfo_records = NULL; + STL_FABRICINFO_RECORD *fabricinfo_records = NULL; + STL_SWITCH_COST_RECORD *cost_records = NULL; + STL_NODE_RECORD *switch_records = NULL; + + STL_NOTICE *notice = NULL; + size_t notice_len = 0; + struct omgt_port *context = NULL; + + uint16_t **cost; + int i,j; + + if (argc < 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + exitcode = 1; + goto done; + } + + matrix_file = fopen(argv[1], "w"); + if (!matrix_file) { + fprintf(stderr, "could not open output file for writing\n"); + exitcode = 1; + goto done; + } + + // create a session + status = omgt_open_port_by_num(&port, 1, 1, NULL); + if (OMGT_STATUS_SUCCESS != status) { + fprintf(stderr, "failed to open port\n"); + exitcode = 1; + goto close_file; + } + + // Determine if SA has Switch Cost Record capabiility + selector.InputType = InputTypeNoInput; + status = omgt_sa_get_classportinfo_records(port, &selector, &num_classportinfo_records, &classportinfo_records); + if (OMGT_STATUS_SUCCESS != status || num_classportinfo_records != 1) { + fprintf(stderr, "failed to execute classportinfo record query. MADStatus=0x%x\n", omgt_get_sa_mad_status(port)); + exitcode = 1; + goto close_port; + } + + if (! (classportinfo_records[0].CapMask && STL_SA_CAPABILITY2_SWCOSTRECORD_SUPPORT)) { + fprintf(stderr, "SA does not support switchcost records\n"); + exitcode = 1; + goto close_port; + } + + // Register for Cost Matrix Change Trap + if ((status = omgt_sa_register_trap(port, STL_TRAP_COST_MATRIX_CHANGE, port)) != OMGT_STATUS_SUCCESS) { + fprintf(stderr, " Error: Could not register for Trap %u: %s (%u)\n", + STL_TRAP_COST_MATRIX_CHANGE, omgt_status_totext(status), status); + exitcode = 1; + goto close_port; + } + + opa_switch *head_switch, *temp_switch = NULL; + while(!exitcode){ + selector.InputType = InputTypeNoInput; + + /* Query SA for fabric information to determine how big to make + * our own cost matrix storage + */ + status = omgt_sa_get_fabric_info_records(port, &selector, &num_fabricinfo_records, &fabricinfo_records); + if (OMGT_STATUS_SUCCESS != status || num_fabricinfo_records < 1) { + fprintf(stderr, "failed to get fabricinfo. MADStatus=0x%x\n", omgt_get_sa_mad_status(port)); + exitcode = 1; + goto cleanup; + } + + /* Using total number of nodes will allocate more space than necessary, + * but allows simpler processing of cost data + */ + num_nodes = fabricinfo_records[0].NumSwitches + fabricinfo_records[0].NumHFIs; + if ((cost = calloc(1, num_nodes * sizeof(uint16_t*))) == NULL) { + fprintf(stderr, "failed to allocate memory\n"); + exitcode = 1; + goto cleanup; + } + + /* Query SA for switch records so we can have the names of the switches + * as the cost records are defined with LIDs + */ + selector.InputType = InputTypeNodeType; // select records by type + selector.InputValue.NodeRecord.NodeType = IBA_NODE_SWITCH; // select only Switches + status = omgt_sa_get_node_records(port, &selector, &num_switch_records, &switch_records); + if (OMGT_STATUS_SUCCESS != status) { + fprintf(stderr, "failed to execute node record query. MADStatus=0x%x\n", omgt_get_sa_mad_status(port)); + exitcode = 1; + goto cleanup; + } + + /* Create a linked list of switches in this fabric + */ + for (i = 0; i < num_switch_records; ++i) { + opa_switch * next_switch; + if ((next_switch = malloc(sizeof(opa_switch))) == NULL) { + fprintf(stderr, "failed to allocate memory\n"); + exitcode = 1; + goto cleanup; + } + + next_switch->lid = switch_records[i].RID.LID; + next_switch->name = get_name(switch_records[i].RID.LID, switch_records, num_switch_records); + next_switch->next = NULL; + + if (temp_switch) + temp_switch->next = next_switch; + else + head_switch = next_switch; + + temp_switch = next_switch; + } + temp_switch = NULL; + + // reset selector to appropriate type for cost query + selector.InputType = InputTypeNoInput; + status = omgt_sa_get_switchcost_records(port, &selector, &num_cost_records, &cost_records); + if (OMGT_STATUS_SUCCESS != status) { + fprintf(stderr, "failed to execute cost record query. MADStatus=0x%x\n", omgt_get_sa_mad_status(port)); + exitcode = 1; + goto cleanup; + } + + /* Copy returned Cost matrix data into our own format + * When requesting the entire matrix, only the lower + * diagonal is returned as it is symmetric + */ + int slid, dlid; + STL_SWITCH_COST_RECORD cost_record; + for (i = 0; i < num_cost_records; ++i) { + cost_record = cost_records[i]; + slid = cost_record.SLID; + /* Cost records contain 64 entries, but all may not be filled + * Checking the DLID is > 0 ensures the entry is valid + */ + for (j = 0; j < STL_SWITCH_COST_NUM_ENTRIES && cost_record.Cost[j].DLID > 0; ++j) { + dlid = cost_record.Cost[j].DLID; + + // Initialize all entries in cost to zero. + // The entries of interest will be overwritten with + // actual cost values from the SA + if (!cost[slid]) { + if ((cost[slid] = calloc(1, num_nodes * sizeof(uint16_t))) == NULL) { + fprintf(stderr, "failed to allocate memory\n"); + exitcode = 1; + goto cleanup; + } + } + if (!cost[dlid]) { + if ((cost[dlid] = calloc(1, num_nodes * sizeof(uint16_t))) == NULL) { + fprintf(stderr, "failed to allocate memory\n"); + exitcode = 1; + goto cleanup; + } + } + // add this cost to matrix for slid/dlid + cost[slid][dlid] = cost[dlid][slid] = cost_record.Cost[j].value; + } + } + + print_matrix(cost, head_switch); + + printf("\nMonitoring for any changes...\n"); + fflush(matrix_file); + + // monitor cluster for changes, -1 = indefinite wait time + if ((status = omgt_sa_get_notice_report(port, ¬ice, ¬ice_len, (void **)&context, -1)) != OMGT_STATUS_SUCCESS) { + fprintf(stderr, "Error: Could not wait for Notice: %s (%u)\n", + omgt_status_totext(status), status); + exitcode = 1; + goto cleanup; + } + + // we only registered for Cost Matrix Change notice, if we got something else it's an error + if (notice->Attributes.Generic.TrapNumber != STL_TRAP_COST_MATRIX_CHANGE) { + fprintf(stderr, "Unhandled Trap Received: %u\n", notice->Attributes.Generic.TrapNumber); + exitcode = 1; + goto cleanup; + } + +cleanup: + if (notice) { + free(notice); + notice = NULL; + } + + if (fabricinfo_records) { + omgt_sa_free_records(fabricinfo_records); + fabricinfo_records = NULL; + } + if (cost_records) { + omgt_sa_free_records(cost_records); + cost_records = NULL; + } + if (switch_records) { + omgt_sa_free_records(switch_records); + switch_records = NULL; + } + + free_switch_list(&head_switch); + free_cost(&cost, num_nodes); + + } //end while + + + if ((status = omgt_sa_unregister_trap(port, STL_TRAP_COST_MATRIX_CHANGE)) != OMGT_STATUS_SUCCESS) { + fprintf(stderr, "Error: Could not unregister for Trap %u: %s (%u)\n", + STL_TRAP_COST_MATRIX_CHANGE, omgt_status_totext(status), status); + if (!exitcode) exitcode = 1; + } + +close_port: + if (classportinfo_records) omgt_sa_free_records(classportinfo_records); + + //close our session + omgt_close_port(port); + +close_file: + fclose(matrix_file); + +done: + return exitcode; +} diff --git a/opamgt/samples/simple_sa_notice.c b/opamgt/samples/simple_sa_notice.c new file mode 100644 index 00000000..c7e7d43d --- /dev/null +++ b/opamgt/samples/simple_sa_notice.c @@ -0,0 +1,117 @@ +// core API +#include +// extensions for SA Notices +#include + +// extension to print gid using inet_ntop() +#include + + +int main(void) +{ + int exit_code = 0; + struct omgt_port *port = NULL; + OMGT_STATUS_T status; + + STL_NOTICE *notice = NULL; + size_t notice_len = 0; + struct omgt_port *context = NULL; + + /* Set Init Params */ + struct omgt_params params = {0}; + params.error_file = stderr; + params.debug_file = NULL; + /* Open in-band port */ + if ((status = omgt_open_port(&port, "hfi1_0", 1, ¶ms)) != OMGT_STATUS_SUCCESS) { + fprintf(stderr, "Error: Could not open port: %s (%u)\n", + omgt_status_totext(status), status); + return 1; + } + + /* Register for Traps (Node Appear | Node Disappear) */ + if ((status = omgt_sa_register_trap(port, STL_TRAP_GID_NOW_IN_SERVICE, port)) != OMGT_STATUS_SUCCESS) { + fprintf(stderr, "Error: Could not register for Trap %u: %s (%u)\n", + STL_TRAP_GID_NOW_IN_SERVICE, omgt_status_totext(status), status); + exit_code = 1; + goto close_port; + } + if ((status = omgt_sa_register_trap(port, STL_TRAP_GID_OUT_OF_SERVICE, port)) != OMGT_STATUS_SUCCESS) { + fprintf(stderr, "Error: Could not register for Trap %u: %s (%u)\n", + STL_TRAP_GID_OUT_OF_SERVICE, omgt_status_totext(status), status); + exit_code = 1; + goto unreg_trap1; + } + + /* Wait for Trap (-1 = indefinite wait time) */ + if ((status = omgt_sa_get_notice_report(port, ¬ice, ¬ice_len, (void **)&context, -1)) != OMGT_STATUS_SUCCESS) { + fprintf(stderr, "Error: Could not wait for Notice: %s (%u)\n", + omgt_status_totext(status), status); + exit_code = 1; + goto unreg_trap2; + } + if (notice_len < sizeof(STL_NOTICE)) { + fprintf(stderr, "Error: Could not get Notice: Returned Length is less than expected: %zu < %zu\n", + notice_len, sizeof(STL_NOTICE)); + exit_code = 2; + goto free_notice; + } + if (port != context) { + fprintf(stderr, "Error: Could not get Notice: Returned context (%p) is not port (%p)\n", + context, port); + exit_code = 2; + goto free_notice; + } + + /* Check Trap Number */ + switch (notice->Attributes.Generic.TrapNumber) { + case STL_TRAP_GID_NOW_IN_SERVICE: + /* New Node Appears */ + { + char gid_buf[46] = {0}; + STL_TRAP_GID *new_gid = (STL_TRAP_GID *)¬ice->Data[0]; + fprintf(stderr, "New Node: %s\n", + inet_ntop(AF_INET6, new_gid, gid_buf, sizeof(gid_buf))); + } + break; + case STL_TRAP_GID_OUT_OF_SERVICE: + /* Node Disapears */ + { + char gid_buf[46] = {0}; + STL_TRAP_GID *new_gid = (STL_TRAP_GID *)¬ice->Data[0]; + fprintf(stderr, "Node Disappears: %s\n", + inet_ntop(AF_INET6, new_gid, gid_buf, sizeof(gid_buf))); + } + break; + default: + fprintf(stderr, "Unhandled Trap Received: %u\n", notice->Attributes.Generic.TrapNumber); + exit_code = 3; + } + + /* Clean Up Notice */ +free_notice: + if (notice) { + free(notice); + notice = NULL; + } + + /* Unregister Traps */ +unreg_trap2: + if ((status = omgt_sa_unregister_trap(port, STL_TRAP_GID_OUT_OF_SERVICE)) != OMGT_STATUS_SUCCESS) { + fprintf(stderr, "Error: Could not unregister for Trap %u: %s (%u)\n", + STL_TRAP_GID_OUT_OF_SERVICE, omgt_status_totext(status), status); + if (!exit_code) exit_code = 1; + } +unreg_trap1: + if ((status = omgt_sa_unregister_trap(port, STL_TRAP_GID_NOW_IN_SERVICE)) != OMGT_STATUS_SUCCESS) { + fprintf(stderr, "Error: Could not unregister for Trap %u: %s (%u)\n", + STL_TRAP_GID_NOW_IN_SERVICE, omgt_status_totext(status), status); + if (!exit_code) exit_code = 1; + } + + /* Close port */ +close_port: + omgt_close_port(port); + port = NULL; + + return exit_code; +} diff --git a/opamgt/src/ib_notice.c b/opamgt/src/ib_notice.c index 83aa7d33..63982977 100644 --- a/opamgt/src/ib_notice.c +++ b/opamgt/src/ib_notice.c @@ -55,8 +55,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ib_utils_openib.h" #include "ib_notice_net.h" -#include "opamgt_sa_priv.h" #include "iba/public/ibyteswap.h" +#include "iba/stl_sa_types.h" +#include "iba/stl_mad_priv.h" #define OMGT_SA_MAX_REGISTRANTS 10 @@ -69,6 +70,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ((type *) ((void *) ptr - offsetof(type, field))) #endif +struct ibv_sa_event { + void *context; + int status; + int attr_count; + int attr_size; + int attr_offset; + uint16_t attr_id; + void *attr; +}; struct omgt_sa_event { struct ibv_sa_event event; struct ibv_sa_event_channel *channel; @@ -199,7 +209,7 @@ static void free_sa_msg(struct omgt_sa_msg *msg) * * @return none */ -static void omgt_sa_add_reg_unsafe(struct omgt_port *port, omgt_sa_registration_t *reg) +void omgt_sa_add_reg_unsafe(struct omgt_port *port, omgt_sa_registration_t *reg) { reg->next = port->regs_list; port->regs_list = reg; @@ -213,44 +223,45 @@ static void set_sa_msg_tid(struct omgt_port *port, struct umad_sa_packet *sa_pkt sa_pkt->mad_hdr.tid = htonll((uint64_t)port->next_tid); } -static void set_sa_common_inform_info(struct omgt_port *port, struct umad_sa_packet *sa_pkt) +static void set_sa_common_stl_inform_info(struct omgt_port *port, struct umad_sa_packet *sa_pkt) { - struct ibv_sa_net_inform_info *ii; + STL_INFORM_INFO *informinfo; - sa_pkt->mad_hdr.base_version = UMAD_BASE_VERSION; - sa_pkt->mad_hdr.mgmt_class = UMAD_CLASS_SUBN_ADM; - sa_pkt->mad_hdr.class_version = UMAD_SA_CLASS_VERSION; - sa_pkt->mad_hdr.method = UMAD_METHOD_SET; - sa_pkt->mad_hdr.attr_id = htons(UMAD_ATTR_INFORM_INFO); + sa_pkt->mad_hdr.base_version = STL_BASE_VERSION; + sa_pkt->mad_hdr.mgmt_class = MCLASS_SUBN_ADM; + sa_pkt->mad_hdr.class_version = STL_SA_CLASS_VERSION; + sa_pkt->mad_hdr.method = MMTHD_SET; + sa_pkt->mad_hdr.attr_id = hton16(STL_MCLASS_ATTRIB_ID_INFORM_INFO); sa_pkt->rmpp_hdr.rmpp_version = UMAD_RMPP_VERSION; sa_pkt->rmpp_hdr.rmpp_type = 0; - ii = (struct ibv_sa_net_inform_info *)sa_pkt->data; + informinfo = (STL_INFORM_INFO *)sa_pkt->data; - ii->lid_range_begin = htons(0xffff); - ii->is_generic = 1; - ii->type = htons(0xffff); - ii->producer_type_vendor_id = htonl(0xffffff); + informinfo->LIDRangeBegin = UINT32_MAX; + informinfo->IsGeneric = 1; + informinfo->Type = UINT16_MAX; + informinfo->u.Generic.u2.s.ProducerType = 0xFFFFFF; } -static void set_sa_common_response_notice(struct omgt_port *port, struct umad_sa_packet *sa_pkt) +static void set_sa_common_stl_response_notice(struct omgt_port *port, struct umad_sa_packet *sa_pkt) { - struct ibv_sa_net_notice *nn; + STL_NOTICE *notice; - sa_pkt->mad_hdr.base_version = UMAD_BASE_VERSION; - sa_pkt->mad_hdr.mgmt_class = UMAD_CLASS_SUBN_ADM; - sa_pkt->mad_hdr.class_version = UMAD_SA_CLASS_VERSION; - sa_pkt->mad_hdr.method = UMAD_METHOD_REPORT_RESP; - sa_pkt->mad_hdr.attr_id = htons(UMAD_ATTR_NOTICE); + sa_pkt->mad_hdr.base_version = STL_BASE_VERSION; + sa_pkt->mad_hdr.mgmt_class = MCLASS_SUBN_ADM; + sa_pkt->mad_hdr.class_version = STL_SA_CLASS_VERSION; + sa_pkt->mad_hdr.method = MMTHD_REPORT_RESP; + sa_pkt->mad_hdr.attr_id = hton16(STL_MCLASS_ATTRIB_ID_NOTICE); sa_pkt->rmpp_hdr.rmpp_version = UMAD_RMPP_VERSION; sa_pkt->rmpp_hdr.rmpp_type = 0; - nn = (struct ibv_sa_net_notice *)sa_pkt->data; + notice = (STL_NOTICE *)sa_pkt->data; // if the Type is set to 0x7f (empty) all other fields are unused - nn->generic_type_producer = htonl(0x7f000000); + notice->Attributes.Generic.u.AsReg32 = 0; + notice->Attributes.Generic.u.s.Type = 0x7f; } static void post_send_sa_msg(struct omgt_port *port, @@ -346,15 +357,15 @@ find_req_by_tid(struct omgt_port *port, uint32_t tid) static void process_sa_get_resp(struct omgt_port *port, struct umad_sa_packet *sa_pkt) { struct omgt_sa_msg *req; - struct ibv_sa_net_inform_info *ii = (struct ibv_sa_net_inform_info *)sa_pkt->data; - uint16_t trap_num = ntohs(ii->trap_num_device_id); + STL_INFORM_INFO *informinfo = (STL_INFORM_INFO *)sa_pkt->data; + uint16_t trap_num = ntoh16(informinfo->u.Generic.TrapNumber); omgt_lock_sem(&port->lock); /* find the registration for this response */ req = find_req_by_tid(port, ntohll(sa_pkt->mad_hdr.tid) & 0xffffffff); if (req) { - if (ii->subscribe == 1) { + if (informinfo->Subscribe == 1) { OMGT_DBGPRINT(port, "registration complete for trap %d; req %p\n", trap_num, req); } else { OMGT_DBGPRINT(port, "UN-registration complete for trap %d; req %p\n", trap_num, req); @@ -384,12 +395,12 @@ static void process_sa_report(struct omgt_port *port, struct umad_sa_packet *sa_ struct umad_sa_packet *response_pkt; struct ibv_send_wr *bad_wr; - struct ibv_sa_net_notice *nn = (struct ibv_sa_net_notice *)sa_pkt->data; - struct ibv_sa_net_notice_data_gid *nngd = (struct ibv_sa_net_notice_data_gid *)&nn->data_details[0]; + STL_NOTICE *notice = (STL_NOTICE *)sa_pkt->data; + STL_TRAP_GID *notice_gid = (STL_TRAP_GID *)¬ice->Data[0]; struct omgt_thread_msg thread_msg; struct iovec iov[2]; size_t write_count, write_size; - uint16_t trap_num = ntohs(nn->trap_num_device_id); + uint16_t trap_num = ntoh16(notice->Attributes.Generic.TrapNumber); // create and send ReportResp to trap notify if (omgt_lock_sem(&port->lock)) { @@ -400,10 +411,13 @@ static void process_sa_report(struct omgt_port *port, struct umad_sa_packet *sa_ response_msg = alloc_send_sa_msg(port); if (response_msg) { + STL_NOTICE *notice_resp; int rc; memset(response_msg->data, 0, sizeof(response_msg->data)); response_pkt = (struct umad_sa_packet *)response_msg->data; - set_sa_common_response_notice(port, response_pkt); + set_sa_common_stl_response_notice(port, response_pkt); + notice_resp = (STL_NOTICE *)response_pkt->data; + BSWAP_STL_NOTICE(notice_resp); response_pkt->mad_hdr.tid = sa_pkt->mad_hdr.tid; if ((rc = ibv_post_send(port->sa_qp, &(response_msg->wr.send), &bad_wr)) != 0) { @@ -415,13 +429,13 @@ static void process_sa_report(struct omgt_port *port, struct umad_sa_packet *sa_ } omgt_unlock_sem(&port->lock); - thread_msg.size = sizeof *nn; + thread_msg.size = sizeof *notice; thread_msg.evt = OMGT_TH_EVT_TRAP_MSG; iov[0].iov_base = &thread_msg; iov[0].iov_len = sizeof thread_msg; - iov[1].iov_base = nn; - iov[1].iov_len = sizeof *nn; + iov[1].iov_base = notice; + iov[1].iov_len = sizeof *notice; write_size = iov[0].iov_len + iov[1].iov_len; if ( write_size != @@ -429,7 +443,8 @@ static void process_sa_report(struct omgt_port *port, struct umad_sa_packet *sa_ OMGT_OUTPUT_ERROR(port, "bad write count %d\n", (int)write_count); OMGT_DBGPRINT(port, "process_sa_report: msg queued - trap %d gid %02x%02x%02x%02x%02x%02x%02x%02x\n", - trap_num, nngd->gid[8],nngd->gid[9],nngd->gid[10],nngd->gid[11],nngd->gid[12],nngd->gid[13],nngd->gid[14],nngd->gid[15]); + trap_num, notice_gid->Gid.Raw[8], notice_gid->Gid.Raw[9], notice_gid->Gid.Raw[10], notice_gid->Gid.Raw[11], + notice_gid->Gid.Raw[12], notice_gid->Gid.Raw[13], notice_gid->Gid.Raw[14], notice_gid->Gid.Raw[15]); } static void process_sa_rcv_msg(struct omgt_port *port, struct omgt_sa_msg *msg) @@ -628,7 +643,7 @@ int stop_ud_cq_monitor(struct omgt_port *port) return 0; } -static int create_sa_qp(struct omgt_port *port) +int create_sa_qp(struct omgt_port *port) { int i; int flags, rc; @@ -772,12 +787,11 @@ static int start_outstanding_req_timer(struct omgt_port *port) /** * port->lock must be held */ -static int userspace_register(struct omgt_port *port, uint16_t trap_num, - omgt_sa_registration_t *reg) +int userspace_register(struct omgt_port *port, uint16_t trap_num, omgt_sa_registration_t *reg) { struct omgt_sa_msg *sa_msg; struct umad_sa_packet *sa_pkt; - struct ibv_sa_net_inform_info *ii; + STL_INFORM_INFO *informinfo; sa_msg = alloc_send_sa_msg(port); if (!sa_msg) @@ -785,11 +799,12 @@ static int userspace_register(struct omgt_port *port, uint16_t trap_num, memset(sa_msg->data, 0, sizeof(sa_msg->data)); sa_pkt = (struct umad_sa_packet *)sa_msg->data; - set_sa_common_inform_info(port, sa_pkt); - ii = (struct ibv_sa_net_inform_info *)sa_pkt->data; - ii->subscribe = 1; - ii->trap_num_device_id = htons(trap_num); - ii->qpn_resptime = htonl(19); + set_sa_common_stl_inform_info(port, sa_pkt); + informinfo = (STL_INFORM_INFO *)sa_pkt->data; + informinfo->Subscribe = 1; + informinfo->u.Generic.TrapNumber = trap_num; + informinfo->u.Generic.u1.s.RespTimeValue = 19; + BSWAP_STL_INFORM_INFO(informinfo); LIST_ADD(&port->pending_reg_msg_head, sa_msg); @@ -812,7 +827,7 @@ static int userspace_unregister(struct omgt_port *port, omgt_sa_registration_t * { struct omgt_sa_msg *sa_msg; struct umad_sa_packet *sa_pkt; - struct ibv_sa_net_inform_info *ii; + STL_INFORM_INFO *informinfo; uint16_t trap_num; if (reg->reg_msg) { @@ -831,11 +846,13 @@ static int userspace_unregister(struct omgt_port *port, omgt_sa_registration_t * trap_num = reg->trap_num; memset(sa_msg->data, 0, sizeof(sa_msg->data)); sa_pkt = (struct umad_sa_packet *)sa_msg->data; - set_sa_common_inform_info(port, sa_pkt); - ii = (struct ibv_sa_net_inform_info *)sa_pkt->data; - ii->subscribe = 0; - ii->trap_num_device_id = htons(trap_num); - ii->qpn_resptime = htonl((port->sa_qp->qp_num << 8) | 19); + set_sa_common_stl_inform_info(port, sa_pkt); + informinfo = (STL_INFORM_INFO *)sa_pkt->data; + informinfo->Subscribe = 0; + informinfo->u.Generic.TrapNumber = trap_num; + informinfo->u.Generic.u1.s.RespTimeValue = 19; + informinfo->u.Generic.u1.s.QPNumber = port->sa_qp->qp_num; + BSWAP_STL_INFORM_INFO(informinfo); LIST_ADD(&port->pending_reg_msg_head, sa_msg); @@ -862,7 +879,7 @@ static int userspace_unregister(struct omgt_port *port, omgt_sa_registration_t * * * @return 0 if success, else error code */ -static FSTATUS omgt_sa_remove_reg_by_trap_unsafe(struct omgt_port *port, uint16_t trap_num) +FSTATUS omgt_sa_remove_reg_by_trap_unsafe(struct omgt_port *port, uint16_t trap_num) { omgt_sa_registration_t *curr = port->regs_list, *prev = NULL; while (curr != NULL) { @@ -883,57 +900,6 @@ static FSTATUS omgt_sa_remove_reg_by_trap_unsafe(struct omgt_port *port, uint16_ return FERROR; } -/** - * Get the buffer counts for QP creation. - */ -FSTATUS omgt_get_sa_buf_cnt(struct omgt_port *port, int *send_cnt, int *recv_cnt) -{ - FSTATUS status = FTIMEOUT; - if (omgt_lock_sem(&port->lock)) { - OMGT_OUTPUT_ERROR(port, "failed to acquire lock (status: %d)\n", status); - return status; - } - status = FSUCCESS; - - if (send_cnt) - *send_cnt = port->num_userspace_send_buf; - if (recv_cnt) - *recv_cnt = port->num_userspace_recv_buf; - - omgt_unlock_sem(&port->lock); - - return status; -} - -/** - * Set the buffer counts for QP creation. - */ -FSTATUS omgt_set_sa_buf_cnt(struct omgt_port *port, int send_cnt, int recv_cnt) -{ - FSTATUS status = FTIMEOUT; - if (omgt_lock_sem(&port->lock)) { - OMGT_OUTPUT_ERROR(port, "failed to acquire lock (status: %d)\n", status); - return status; - } - status = FSUCCESS; - - if (port->sa_qp){ - OMGT_OUTPUT_ERROR(port, "Cannot modify port buffer counts once a trap is registered.\n"); - status = FERROR; - goto buf_cnt_too_late; - } - - if (send_cnt) - port->num_userspace_send_buf = send_cnt; - if (recv_cnt) - port->num_userspace_recv_buf = recv_cnt; - -buf_cnt_too_late: - omgt_unlock_sem(&port->lock); - - return status; -} - /** * Clear all registrations from the port. */ @@ -978,267 +944,3 @@ int reregister_traps(struct omgt_port *port) omgt_unlock_sem(&port->lock); return 0; } - -/** - * Find a previous registration - * - * @return 0 if success, else error code - */ -static omgt_sa_registration_t *omgt_sa_find_reg(struct omgt_port *port, uint16_t trap_num) -{ - omgt_sa_registration_t *curr = port->regs_list; - while (curr != NULL) { - if (curr->trap_num == trap_num) { - return curr; - } - curr = curr->next; - } - return NULL; -} - -/** - * Initiates a registration for the specified trap. - * - * @param port port opened by omgt_open_port_* - * @param trap_num The trap number to register for - * @param port_num port number requesting trap - * @param context optional opaque info - * - * @return 0 if success, else error code - */ -FSTATUS omgt_sa_register_trap(struct omgt_port *port, - uint16_t trap_num, - void *context) -{ - FSTATUS status; - int ret; - omgt_sa_registration_t *reg; - - reg = (omgt_sa_registration_t *)calloc(1, sizeof *reg); - if (reg == NULL) { - OMGT_OUTPUT_ERROR(port, "failed to allocate reg structure\n"); - return FERROR; - } - - status = FTIMEOUT; - if (omgt_lock_sem(&port->lock)) { - OMGT_OUTPUT_ERROR(port, "failed to acquire lock (status: %d)\n", status); - free(reg); - return (FERROR); - } - - if (omgt_sa_find_reg(port, trap_num)) { - omgt_unlock_sem(&port->lock); - free(reg); - return FSUCCESS; - } - - if ((ret = create_sa_qp(port)) != 0) { - omgt_unlock_sem(&port->lock); - OMGT_OUTPUT_ERROR(port, "failed to create notice QP for trap (%u) registration (status: %d)\n", - trap_num, ret); - } - else if ((ret = userspace_register(port, trap_num, reg)) != 0) { - omgt_unlock_sem(&port->lock); - OMGT_OUTPUT_ERROR(port, "failed to register for trap (%u) (status: %d)\n", - trap_num, ret); - } - - if (ret) { - free(reg); - return FERROR; - } - - reg->user_context = context; - reg->trap_num = trap_num; - omgt_sa_add_reg_unsafe(port, reg); - - omgt_unlock_sem(&port->lock); - return FSUCCESS; -} - -/** - * Unregisters for the specified trap. - * - * @param port port opened by omgt_open_port_* - * @param trap_num The trap number to unregister - * - * @return - */ -FSTATUS omgt_sa_unregister_trap(struct omgt_port *port, uint16_t trap_num) -{ - FSTATUS status; - status = FTIMEOUT; - - if (omgt_lock_sem(&port->lock)) - return (FERROR); - - status = omgt_sa_remove_reg_by_trap_unsafe(port, trap_num); - - omgt_unlock_sem(&port->lock); - return status; -} - -/** - * Fetches the next available notice. Blocks in kernel (interrupted on - * process signal). - * - * @param port port opened by omgt_open_port_* - * @param target_buf Pointer to buffer to place notice into - * @param buf_size Size of the target buffer - * @param bytes_written OUTPUT: Set to the number of bytes written - * written into the buffer - * - * @return 0 if success, else error code - */ -FSTATUS omgt_sa_get_event(struct omgt_port *port, void *target_buf, - size_t buf_size, int *bytes_written) -{ - int rc; - int s; - struct pollfd pollfd[1]; - struct omgt_thread_msg *msg; - struct ibv_sa_net_notice *nn; - uint8_t rdbuf[2048]; - - pollfd[0].fd = port->umad_port_sv[0]; - pollfd[0].events = POLLIN; - pollfd[0].revents = 0; - - if ((rc = poll(pollfd, 1, -1)) < 0) { - OMGT_OUTPUT_ERROR(port, "trap poll failed : %s\n", strerror(errno)); - return FERROR; - } - else if (pollfd[0].revents & POLLIN) { - s = read(port->umad_port_sv[0], rdbuf, sizeof rdbuf); - if (s <= 0) { - OMGT_OUTPUT_ERROR(port, "user event read failed : %s\n", strerror(errno)); - return FERROR; - } - - msg = (struct omgt_thread_msg *)rdbuf; - if (OMGT_TH_EVT_TRAP_MSG == msg->evt) { - if ( msg->size > buf_size) - msg->size = buf_size; - - memcpy(target_buf, (rdbuf + sizeof *msg), msg->size); - *bytes_written = msg->size; - - nn = (struct ibv_sa_net_notice *)target_buf; - OMGT_DBGPRINT(port, "trap message %u: %d bytes\n", ntohs(nn->trap_num_device_id), (int)(msg->size)); - } - else if (OMGT_TH_EVT_TRAP_REG_ERR_TIMEOUT == msg->evt) { - if ( msg->size > buf_size) - msg->size = buf_size; - - memcpy(target_buf, (rdbuf + sizeof *msg), msg->size); - *bytes_written = msg->size; - - OMGT_DBGPRINT(port, "registration of trap message timed out\n"); - return FTIMEOUT; - } - else { - OMGT_OUTPUT_ERROR(port, "user event read invalid message.\n"); - return FERROR; - } - } - else { - OMGT_DBGPRINT(port, "trap poll unexpected result : %d\n", pollfd[0].revents); - return FERROR; - } - - return FSUCCESS; -} - -/** - * Fetches the next available notice. Blocks (interrupted on - * process signal). - * - * @param port port opened by omgt_open_port_* - * @param event Pointer to structure to place event notice into - * - * @return 0 if success, else error code - */ -FSTATUS omgt_get_sa_event(struct omgt_port *port, struct ibv_sa_event **event) -{ - struct ibv_sa_event_channel *channel; - struct omgt_sa_event *evt; - uint8_t target_buf[2048]; - int bytes_written; - omgt_sa_registration_t *reg; - struct ibv_sa_net_notice *nn; - uint16_t trap_num; - FSTATUS ret; - - channel = port->channel; - - evt = (struct omgt_sa_event *)calloc(1, sizeof *evt); - if (!evt) - return ENOMEM; - else - *event = &evt->event; - - ret = omgt_sa_get_event(port, target_buf, - sizeof target_buf, &bytes_written); - if ( FSUCCESS == ret) { - nn = (struct ibv_sa_net_notice *)target_buf; - trap_num = ntohs(nn->trap_num_device_id); - - evt->channel = channel; - evt->event.status = 0; - reg = omgt_sa_find_reg(port, trap_num); - if (NULL == reg) { - evt->event.context = NULL; - } else { - evt->event.context = reg->user_context; - } - evt->event.attr_id = IBV_SA_ATTR_NOTICE; - - if (bytes_written) { - evt->data = malloc(bytes_written); - if (!evt->data) { - ret = FINSUFFICIENT_MEMORY; - goto err; - } - - memcpy(evt->data, target_buf, bytes_written); - (*event)->attr = evt->data; - (*event)->attr_size = bytes_written; - (*event)->attr_count = 1; - } - - return FSUCCESS; - } - else if (FTIMEOUT == ret) { - reg = (omgt_sa_registration_t *)target_buf; - - evt->data = NULL; - evt->channel = channel; - evt->event.context = reg->user_context; - evt->event.attr_id = IBV_SA_ATTR_INFORM_INFO; - evt->event.status = -ETIMEDOUT; - return FSUCCESS; - } - ret = FERROR; -err: - free(evt); - return ret; -} - -/** - * Clean up ibv_sa_event structure - * - * @param event Pointer to structure to place event notice into - * - * @return 0 if success, else error code - */ -FSTATUS omgt_ack_sa_event(struct ibv_sa_event *event) -{ - struct omgt_sa_event *evt = container_of(event, struct omgt_sa_event, event); - - if (evt->data) - free(evt->data); - - free(event); - return FSUCCESS; -} diff --git a/opamgt/src/ib_utils_openib.h b/opamgt/src/ib_utils_openib.h index 498137a0..89f261b7 100644 --- a/opamgt/src/ib_utils_openib.h +++ b/opamgt/src/ib_utils_openib.h @@ -231,7 +231,6 @@ typedef struct { #define OMGT_PKEY_MASK 0x7fff #define OMGT_PKEY_FULL_BIT 0x8000 #define OMGT_INVALID_AGENTID -1 -#define OPAMGT_DEF_TIMEOUT_MS 1000 #define DEFAULT_USERSPACE_RECV_BUF 512 #define DEFAULT_USERSPACE_SEND_BUF 128 #define NOTICE_REG_TIMEOUT_MS 1000 /* 1sec */ @@ -316,6 +315,10 @@ struct omgt_port { FILE *dbg_file; FILE *error_file; + /* Timeout & Retries */ + int ms_timeout; + int retry_count; + /* SA interaction for userspace Notice registration */ struct ibv_comp_channel *sa_qp_comp_channel; struct ibv_cq *sa_qp_cq; @@ -331,13 +334,16 @@ struct omgt_port { int outstanding_sends_cnt; struct omgt_sa_msg pending_reg_msg_head; struct omgt_sa_msg *recv_bufs; + + /* For SA Client interface */ uint16_t sa_mad_status; + int sa_service_state; /* For PA client interface */ IB_GID local_gid; FILE *verbose_file; int pa_verbose; - int pa_client_state; + int pa_service_state; uint16_t primary_pm_lid; uint8_t primary_pm_sl; uint16_t pa_mad_status; @@ -377,6 +383,11 @@ int repost_pending_registrations(struct omgt_port *port); int reregister_traps(struct omgt_port *port); void omgt_sa_remove_all_pending_reg_msgs(struct omgt_port *port); +int create_sa_qp(struct omgt_port *port); +int userspace_register(struct omgt_port *port, uint16_t trap_num, omgt_sa_registration_t *reg); +void omgt_sa_add_reg_unsafe(struct omgt_port *port, omgt_sa_registration_t *reg); +FSTATUS omgt_sa_remove_reg_by_trap_unsafe(struct omgt_port *port, uint16_t trap_num); + #define LIST_INIT(obj) \ (obj)->next = obj; \ (obj)->prev = obj; diff --git a/opamgt/src/iba2ibo_util_helper.c b/opamgt/src/iba2ibo_util_helper.c index c0e982ca..cc389a66 100644 --- a/opamgt/src/iba2ibo_util_helper.c +++ b/opamgt/src/iba2ibo_util_helper.c @@ -40,8 +40,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #define OPAMGT_PRIVATE 1 -// Includes / Defines from IBACCESS -//#include "iba/ibt.h" #include "ibt.h" #include "ib_utils_openib.h" diff --git a/opamgt/src/omgt_oob_connections.c b/opamgt/src/omgt_oob_connections.c index e7e5592a..c0ac07be 100644 --- a/opamgt/src/omgt_oob_connections.c +++ b/opamgt/src/omgt_oob_connections.c @@ -48,7 +48,14 @@ OMGT_STATUS_T omgt_oob_connect(struct omgt_port **port, struct omgt_oob_input *o if (session_params) { prt->dbg_file = session_params->debug_file; prt->error_file = session_params->error_file; + } else { + prt->dbg_file = NULL; + prt->error_file = NULL; } + + prt->ms_timeout = OMGT_DEF_TIMEOUT_MS; + prt->retry_count = OMGT_DEF_RETRY_CNT; + /* copy login info into port struct */ prt->oob_input = *oob_input; @@ -130,8 +137,8 @@ FSTATUS omgt_oob_receive_response(struct omgt_port *port, uint8_t **data, uint32 boolean data_null; boolean response_acquired; - time_t current_time; - time_t start_time; + struct timeval start, current; + uint64_t delta_ms, total_timeout; /* Do nothing if no conn */ if (!port || !port->conn) @@ -142,9 +149,11 @@ FSTATUS omgt_oob_receive_response(struct omgt_port *port, uint8_t **data, uint32 while (response_acquired != TRUE) { e = FSUCCESS; data_null = TRUE; - (void)time(&start_time); - (void)time(¤t_time); - while ((difftime(current_time, start_time) < (double)5.0) && data_null) { + (void)gettimeofday(&start, NULL); + (void)gettimeofday(¤t, NULL); + delta_ms = 0; + total_timeout = port->ms_timeout * (port->retry_count + 1); + while (delta_ms < total_timeout && data_null) { omgt_oob_net_process(port, 100, 1); omgt_oob_net_get_next_message(port->conn, (uint8_t **)&packet, (int *)len); if (packet != NULL) { @@ -153,7 +162,9 @@ FSTATUS omgt_oob_receive_response(struct omgt_port *port, uint8_t **data, uint32 if (port->conn->err) { return FERROR; } - (void)time(¤t_time); + (void)gettimeofday(¤t, NULL); + /* Get Delta in ms */ + delta_ms = ((current.tv_sec - start.tv_sec) * 1000) + ((current.tv_usec - start.tv_usec) / 1000); } } if (data_null == TRUE) { diff --git a/opamgt/src/omgt_oob_net.c b/opamgt/src/omgt_oob_net.c index c1d57360..1c73e033 100644 --- a/opamgt/src/omgt_oob_net.c +++ b/opamgt/src/omgt_oob_net.c @@ -73,9 +73,14 @@ FSTATUS omgt_oob_net_connect(struct omgt_port *port) int inaddr = 0; int ipv6 = 0; - /* - * First resolve the hostname and fill in the sockaddr - */ + /* Set Timeout to default value if incorrect value */ + if (port->ms_timeout <= 0) { + port->ms_timeout = OMGT_DEF_TIMEOUT_MS; + } + if (port->retry_count < 0) { + port->retry_count = OMGT_DEF_RETRY_CNT; + } + /* First resolve the hostname and fill in the sockaddr */ inaddr = inet_pton(AF_INET6, port->oob_input.host, &ipv6addr); if ((ipv6 = (inaddr == 1) ? 1 : 0)) { @@ -105,9 +110,7 @@ FSTATUS omgt_oob_net_connect(struct omgt_port *port) } } - /* - * Next, create a socket and attempt the connection - */ + /* Next, create a socket and attempt the connection */ conn = omgt_oob_new_connection(); if (conn == NULL) { OMGT_OUTPUT_ERROR(port, "no memory for connection.\n"); diff --git a/opamgt/src/omgt_oob_ssl.c b/opamgt/src/omgt_oob_ssl.c index 3e9fb15c..a72e87f9 100644 --- a/opamgt/src/omgt_oob_ssl.c +++ b/opamgt/src/omgt_oob_ssl.c @@ -38,6 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #define OPAMGT_PRIVATE 1 diff --git a/opamgt/src/opamgt.c b/opamgt/src/opamgt.c index 470bc4df..ac102bf3 100644 --- a/opamgt/src/opamgt.c +++ b/opamgt/src/opamgt.c @@ -50,8 +50,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "omgt_oob_net.h" #include "opamgt_dump_mad.h" #include "opamgt_sa_priv.h" +#include "opamgt_pa_priv.h" #include "stl_convertfuncs.h" -#include "iba/ib_sm.h" +#include "iba/ib_sm_priv.h" #include "iba/ib_generalServices.h" /** ========================================================================= */ @@ -64,7 +65,61 @@ void omgt_set_err(struct omgt_port *port, FILE *file) { if (port) port->error_file = file; } - +/** ========================================================================= */ +void omgt_set_timeout(struct omgt_port *port, int ms_timeout) +{ + if (port) { + port->ms_timeout = (ms_timeout > 0 ? ms_timeout : OMGT_DEF_TIMEOUT_MS); + } +} +/** ========================================================================= */ +void omgt_set_retry_count(struct omgt_port *port, int retry_count) +{ + if (port) { + port->retry_count = (retry_count >= 0 ? retry_count : OMGT_DEF_RETRY_CNT); + } +} +/** ========================================================================= */ +const char* omgt_status_totext(OMGT_STATUS_T status) +{ + switch (status) { + case OMGT_STATUS_SUCCESS: return "Success"; + case OMGT_STATUS_ERROR: return "Error"; + case OMGT_STATUS_INVALID_STATE: return "Invalid State"; + case OMGT_STATUS_INVALID_OPERATION: return "Invalid Operation"; + case OMGT_STATUS_INVALID_SETTING: return "Invalid Setting"; + case OMGT_STATUS_INVALID_PARAMETER: return "Invalid Parameter"; + case OMGT_STATUS_INSUFFICIENT_RESOURCES: return "Insufficient Resources"; + case OMGT_STATUS_INSUFFICIENT_MEMORY: return "Insufficient Memory"; + case OMGT_STATUS_COMPLETED: return "Completed"; + case OMGT_STATUS_NOT_DONE: return "Not Done"; + case OMGT_STATUS_PENDING: return "Pending"; + case OMGT_STATUS_TIMEOUT: return "Timeout"; + case OMGT_STATUS_CANCELED: return "Canceled"; + case OMGT_STATUS_REJECT: return "Reject"; + case OMGT_STATUS_OVERRUN: return "Overrun"; + case OMGT_STATUS_PROTECTION: return "Protection"; + case OMGT_STATUS_NOT_FOUND: return "Not Found"; + case OMGT_STATUS_UNAVAILABLE: return "Unavailable"; + case OMGT_STATUS_BUSY: return "Busy"; + case OMGT_STATUS_DISCONNECT: return "Disconnect"; + case OMGT_STATUS_DUPLICATE: return "Duplicate"; + case OMGT_STATUS_POLL_NEEDED: return "Poll Needed"; + default: return "Unknown"; + } +} +/** ========================================================================= */ +const char* omgt_service_state_totext(int service_state) +{ + switch (service_state) { + case OMGT_SERVICE_STATE_OPERATIONAL: return "Operational"; + case OMGT_SERVICE_STATE_DOWN: return "Down"; + case OMGT_SERVICE_STATE_UNAVAILABLE: return "Unavailable"; + case OMGT_SERVICE_STATE_UNKNOWN: + default: + return "Unknown"; + } +} /** ========================================================================= * Init sub libraries like umad here * */ @@ -543,6 +598,10 @@ static OMGT_STATUS_T omgt_open_port_internal(struct omgt_port *port, char *hfi_n goto free_port; } + /* Set Timeout and retry to default values */ + port->ms_timeout = OMGT_DEF_TIMEOUT_MS; + port->retry_count = OMGT_DEF_RETRY_CNT; + if ((port->umad_fd = umad_open_port(hfi_name, port_num)) < 0) { OMGT_OUTPUT_ERROR(port, "can't open UMAD port (%s:%d)\n", hfi_name, port_num); err = OMGT_STATUS_INVALID_PARAMETER; @@ -642,6 +701,9 @@ OMGT_STATUS_T omgt_open_port(struct omgt_port **port, char *hfi_name, uint8_t po if (session_params) { rc->dbg_file = session_params->debug_file; rc->error_file = session_params->error_file; + } else { + rc->dbg_file = NULL; + rc->error_file = NULL; } status = omgt_open_port_internal(rc, hfi_name, port_num); @@ -671,6 +733,9 @@ OMGT_STATUS_T omgt_open_port_by_num(struct omgt_port **port, int32_t hfi_num, ui if (session_params) { rc->dbg_file = session_params->debug_file; rc->error_file = session_params->error_file; + } else { + rc->dbg_file = NULL; + rc->error_file = NULL; } status = omgt_get_portguid(hfi_num, port_num, NULL, rc, NULL, NULL, NULL, @@ -715,6 +780,9 @@ OMGT_STATUS_T omgt_open_port_by_guid(struct omgt_port **port, uint64_t port_guid if (session_params) { rc->dbg_file = session_params->debug_file; rc->error_file = session_params->error_file; + } else { + rc->dbg_file = NULL; + rc->error_file = NULL; } status = omgt_get_hfi_from_portguid(port_guid, rc, name, NULL, &num, @@ -1074,7 +1142,78 @@ OMGT_STATUS_T omgt_port_get_node_type(struct omgt_port *port, uint8_t *node_type *node_type = STL_NODE_FI; return OMGT_STATUS_SUCCESS; } +OMGT_STATUS_T omgt_port_get_sa_service_state(struct omgt_port *port, int *sa_service_state, uint32_t refresh) +{ + int need_refresh = 0; + OMGT_STATUS_T query_status = OMGT_STATUS_SUCCESS; + if (port->is_oob_enabled) { + OMGT_OUTPUT_ERROR(port, "Port in Out-of-Band Mode, no SA Service State\n"); + return OMGT_STATUS_INVALID_STATE; + } + + /* Check if we should attempt to refresh */ + switch (refresh) { + case OMGT_REFRESH_SERVICE_NOP: + break; + case OMGT_REFRESH_SERVICE_BAD_STATE: + if (port->sa_service_state != OMGT_SERVICE_STATE_OPERATIONAL) { + need_refresh = 1; + } + break; + case OMGT_REFRESH_SERVICE_ANY_STATE: + need_refresh = 1; + break; + default: + OMGT_OUTPUT_ERROR(port, "Invalid Refresh Flags: 0x%x\n", refresh); + return OMGT_STATUS_INVALID_PARAMETER; + } + if (need_refresh == 1) { + /* Refresh SA Client */ + query_status = omgt_query_sa(port, NULL, NULL); + if (query_status != OMGT_STATUS_SUCCESS) { + OMGT_OUTPUT_ERROR(port, "Failed to refresh SA Service State: %u\n", query_status); + return query_status; + } + } + + *sa_service_state = port->sa_service_state; + return OMGT_STATUS_SUCCESS; +} + +OMGT_STATUS_T omgt_port_get_pa_service_state(struct omgt_port *port, int *pa_service_state, uint32_t refresh) +{ + int need_refresh = 0; + + if (port->is_oob_enabled) { + OMGT_OUTPUT_ERROR(port, "Port in Out-of-Band Mode, no PA Service State\n"); + return OMGT_STATUS_INVALID_STATE; + } + + /* Check if we should attempt to refresh */ + switch (refresh) { + case OMGT_REFRESH_SERVICE_NOP: + break; + case OMGT_REFRESH_SERVICE_BAD_STATE: + if (port->pa_service_state != OMGT_SERVICE_STATE_OPERATIONAL) { + need_refresh = 1; + } + break; + case OMGT_REFRESH_SERVICE_ANY_STATE: + need_refresh = 1; + break; + default: + OMGT_OUTPUT_ERROR(port, "Invalid Refresh Flags: 0x%x\n", refresh); + return OMGT_STATUS_INVALID_PARAMETER; + } + if (need_refresh == 1) { + /* Refresh PA Client */ + (void)omgt_pa_service_connect(port); + } + + *pa_service_state = port->pa_service_state; + return OMGT_STATUS_SUCCESS; +} /** ========================================================================= */ OMGT_STATUS_T omgt_port_get_ip_version(struct omgt_port *port, uint8_t *ip_version) { @@ -1564,14 +1703,15 @@ FSTATUS omgt_send_mad2(struct omgt_port *port, uint8_t *send_mad, size_t send_si umad_set_addr(umad_p, ib_lid?ib_lid:0xffff, addr->qpn, addr->sl, addr->qkey); + correctedTimeout = (timeout_ms == OMGT_SEND_TIMEOUT_DEFAULT) + ? OMGT_DEF_TIMEOUT_MS : timeout_ms; + if (port->dbg_file) { OMGT_DBGPRINT(port, ">>> sending: len %ld pktsz %zu\n", send_size, umad_size() + padded_size); umad_dump(umad_p); omgt_dump_mad(port->dbg_file, umad_get_mad(umad_p), send_size, "send mad\n"); } - correctedTimeout = (timeout_ms == OMGT_SEND_TIMEOUT_DEFAULT) - ? OPAMGT_DEF_TIMEOUT_MS : timeout_ms; if (umad_send(port->umad_fd, aid, umad_p, padded_size, (response ? 0 : correctedTimeout), retries) < 0) { OMGT_OUTPUT_ERROR(port, "send failed; %s, agent id %u MClass 0x%x method 0x%x attrId 0x%x attrM 0x%x\n", @@ -1644,7 +1784,7 @@ FSTATUS omgt_recv_mad_alloc(struct omgt_port *port, uint8_t **recv_mad, size_t * // just to be safe, we supply a timeout. However it // should be unnecessary since we know we have a packet retry2: - if ((mad_agent = umad_recv(port->umad_fd, umad, (int *)&length, OPAMGT_DEF_TIMEOUT_MS)) < 0) { + if ((mad_agent = umad_recv(port->umad_fd, umad, (int *)&length, OMGT_DEF_TIMEOUT_MS)) < 0) { OMGT_OUTPUT_ERROR(port, "recv error on umad length %ld (%s)\n", length, strerror(errno)); if (errno == EINTR) goto retry2; @@ -1832,7 +1972,7 @@ FSTATUS omgt_recv_mad_no_alloc(struct omgt_port *port, uint8_t *recv_mad, size_t // just to be safe, we supply a timeout. However it // should be unnecessary since we know we have a packet retry2: - if (umad_recv(port->umad_fd, umad, (int *)&length, OPAMGT_DEF_TIMEOUT_MS) < 0) { + if (umad_recv(port->umad_fd, umad, (int *)&length, OMGT_DEF_TIMEOUT_MS) < 0) { OMGT_OUTPUT_ERROR(port, "recv error on cleanup, length %ld (%s)\n", length, strerror(errno)); if (errno == EINTR) diff --git a/opamgt/src/opamgt_dump_mad.c b/opamgt/src/opamgt_dump_mad.c index 495c23c1..c3f5e8c7 100644 --- a/opamgt/src/opamgt_dump_mad.c +++ b/opamgt/src/opamgt_dump_mad.c @@ -33,10 +33,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include -#include +#include +#include #include -#include +#include #include #include @@ -226,8 +226,9 @@ const char *stl_attribute_str(uint8_t BaseVersion, uint8_t class, be16_t attr) case STL_SA_ATTR_SWITCH_CONG_RECORD: return("SwitchCongestionRecord"); case STL_SA_ATTR_SWITCH_PORT_CONG_RECORD: return("SwitchPortCongestionRecord"); case STL_SA_ATTR_HFI_CONG_RECORD: return("HFICongestionRecord"); - case STL_SA_ATTR_HFI_CONG_CTRL_RECORD: return("HFICongestionCtrlRecord"); - } + case STL_SA_ATTR_HFI_CONG_CTRL_RECORD: return("HFICongestionCtrlRecord"); + case STL_SA_ATTR_SWITCH_COST_RECORD: return("SwitchCostRecord"); + } break; case MCLASS_PERF: //PM //0x04 switch (ntoh16(attr)) { diff --git a/opamgt/src/opamgt_pa.c b/opamgt/src/opamgt_pa.c index 9f2c359e..e3002a38 100644 --- a/opamgt/src/opamgt_pa.c +++ b/opamgt/src/opamgt_pa.c @@ -52,8 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ibt.h" #include "opamgt_priv.h" #include "ib_utils_openib.h" -#include "ib_pm.h" -#include "stl_pa.h" +#include "stl_pa_priv.h" #include "ib_mad.h" #include "opamgt_dump_mad.h" #include "stl_sd.h" @@ -176,9 +175,11 @@ pa_query_common( OMGT_OUTPUT_ERROR(port, "Local port not Active!\n"); return FINVALID_STATE; } - if ((port->pa_client_state != PACLIENT_OPERATIONAL) && - (omgt_pa_client_connect(port) != PACLIENT_OPERATIONAL)){ - OMGT_OUTPUT_ERROR(port, "Query PA failed: PA interface not available\n"); + if ((port->pa_service_state != OMGT_SERVICE_STATE_OPERATIONAL) + && (omgt_pa_service_connect(port) != OMGT_SERVICE_STATE_OPERATIONAL)) { + + OMGT_OUTPUT_ERROR(port, "Query PA failed: PA Service Not Operational: %s (%d)\n", + omgt_service_state_totext(port->pa_service_state), port->pa_service_state); return FUNAVAILABLE; } addr.lid = port->primary_pm_lid; @@ -216,13 +217,15 @@ pa_query_common( // submit RMPP MAD request fstatus = omgt_send_recv_mad_alloc(port, snd_data, (size_t)snd_data_len, &addr, - (uint8_t **)rsp_mad, rcv_buf_len, DEFAULT_SD_TIMEOUT, DEFAULT_SD_RETRY_COUNT); + (uint8_t **)rsp_mad, rcv_buf_len, port->ms_timeout, port->retry_count); if (fstatus != FSUCCESS) { - OMGT_DBGPRINT(port, "Query PA failed to send: %u\n", (unsigned int)fstatus); if (fstatus == FPROTECTION) { // PKEY lookup error. - OMGT_OUTPUT_ERROR(port, "Query PA failed: requires full management node. Status:(%u)\n", (unsigned int)fstatus); + OMGT_OUTPUT_ERROR(port, "Query Failed: requires full management node.\n"); + } else { + OMGT_DBGPRINT(port, "Query Failed: %u. Marking PA Service State DOWN\n", (unsigned int)fstatus); + port->pa_service_state = OMGT_SERVICE_STATE_DOWN; } goto done; } @@ -495,12 +498,12 @@ iba_pa_single_mad_port_counters_response_query( } } - response = MemoryAllocate2AndClear(STL_PA_PORT_COUNTERS_NSIZE, IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); + response = MemoryAllocate2AndClear(sizeof(STL_PORT_COUNTERS_DATA), IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); if (response == NULL) { OMGT_OUTPUT_ERROR(port, "error allocating response buffer\n"); goto done; } - memcpy((uint8 *)response, rsp_mad->Data, min(STL_PA_PORT_COUNTERS_NSIZE, rcv_buf_len - IB_SA_DATA_OFFS)); + memcpy((uint8 *)response, rsp_mad->Data, min(sizeof(STL_PORT_COUNTERS_DATA), rcv_buf_len - IB_SA_DATA_OFFS)); // translate the data. BSWAP_STL_PA_PORT_COUNTERS(response); @@ -570,12 +573,12 @@ iba_pa_single_mad_clr_port_counters_response_query( } } - response = MemoryAllocate2AndClear(STL_PA_CLR_PORT_COUNTERS_NSIZE, IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); + response = MemoryAllocate2AndClear(sizeof(STL_CLR_PORT_COUNTERS_DATA), IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); if (response == NULL) { OMGT_OUTPUT_ERROR(port, "error allocating response buffer\n"); goto done; } - memcpy((uint8 *)response, rsp_mad->Data, min(STL_PA_CLR_PORT_COUNTERS_NSIZE, rcv_buf_len - IB_SA_DATA_OFFS)); + memcpy((uint8 *)response, rsp_mad->Data, min(sizeof(STL_CLR_PORT_COUNTERS_DATA), rcv_buf_len - IB_SA_DATA_OFFS)); // translate the data. BSWAP_STL_PA_CLR_PORT_COUNTERS(response); @@ -638,12 +641,12 @@ iba_pa_single_mad_clr_all_port_counters_response_query( } } - response = MemoryAllocate2AndClear(STL_PA_CLR_ALL_PORT_COUNTERS_NSIZE, IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); + response = MemoryAllocate2AndClear(sizeof(STL_CLR_ALL_PORT_COUNTERS_DATA), IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); if (response == NULL) { OMGT_OUTPUT_ERROR(port, "error allocating response buffer\n"); goto done; } - memcpy((uint8 *)response, rsp_mad->Data, min(STL_PA_CLR_ALL_PORT_COUNTERS_NSIZE, rcv_buf_len - IB_SA_DATA_OFFS)); + memcpy((uint8 *)response, rsp_mad->Data, min(sizeof(STL_CLR_ALL_PORT_COUNTERS_DATA), rcv_buf_len - IB_SA_DATA_OFFS)); // translate the data. BSWAP_STL_PA_CLR_ALL_PORT_COUNTERS(response); @@ -698,12 +701,12 @@ iba_pa_single_mad_get_pm_config_response_query( } } - response = MemoryAllocate2AndClear(STL_PA_PM_CONFIG_NSIZE, IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); + response = MemoryAllocate2AndClear(sizeof(STL_PA_PM_CFG_DATA), IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); if (response == NULL) { OMGT_OUTPUT_ERROR(port, "error allocating response buffer\n"); goto done; } - memcpy((uint8 *)response, rsp_mad->Data, min(STL_PA_PM_CONFIG_NSIZE, rcv_buf_len - IB_SA_DATA_OFFS)); + memcpy((uint8 *)response, rsp_mad->Data, min(sizeof(STL_PA_PM_CFG_DATA), rcv_buf_len - IB_SA_DATA_OFFS)); // translate the data. BSWAP_STL_PA_PM_CFG(response); @@ -765,12 +768,12 @@ iba_pa_single_mad_freeze_image_response_query( } } - response = MemoryAllocate2AndClear(STL_PA_IMAGE_ID_NSIZE, IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); + response = MemoryAllocate2AndClear(sizeof(STL_PA_IMAGE_ID_DATA), IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); if (response == NULL) { OMGT_OUTPUT_ERROR(port, "error allocating response buffer\n"); goto done; } - memcpy((uint8 *)response, rsp_mad->Data, min(STL_PA_IMAGE_ID_NSIZE, rcv_buf_len - IB_SA_DATA_OFFS)); + memcpy((uint8 *)response, rsp_mad->Data, min(sizeof(STL_PA_IMAGE_ID_DATA), rcv_buf_len - IB_SA_DATA_OFFS)); // translate the data. BSWAP_STL_PA_IMAGE_ID(response); @@ -832,12 +835,12 @@ iba_pa_single_mad_release_image_response_query( } } - response = MemoryAllocate2AndClear(STL_PA_IMAGE_ID_NSIZE, IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); + response = MemoryAllocate2AndClear(sizeof(STL_PA_IMAGE_ID_DATA), IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); if (response == NULL) { OMGT_OUTPUT_ERROR(port, "error allocating response buffer\n"); goto done; } - memcpy((uint8 *)response, rsp_mad->Data, min(STL_PA_IMAGE_ID_NSIZE, rcv_buf_len - IB_SA_DATA_OFFS)); + memcpy((uint8 *)response, rsp_mad->Data, min(sizeof(STL_PA_IMAGE_ID_DATA), rcv_buf_len - IB_SA_DATA_OFFS)); // translate the data. BSWAP_STL_PA_IMAGE_ID(response); @@ -899,12 +902,12 @@ iba_pa_single_mad_renew_image_response_query( } } - response = MemoryAllocate2AndClear(STL_PA_IMAGE_ID_NSIZE, IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); + response = MemoryAllocate2AndClear(sizeof(STL_PA_IMAGE_ID_DATA), IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); if (response == NULL) { OMGT_OUTPUT_ERROR(port, "error allocating response buffer\n"); goto done; } - memcpy((uint8 *)response, rsp_mad->Data, min(STL_PA_IMAGE_ID_NSIZE, rcv_buf_len - IB_SA_DATA_OFFS)); + memcpy((uint8 *)response, rsp_mad->Data, min(sizeof(STL_PA_IMAGE_ID_DATA), rcv_buf_len - IB_SA_DATA_OFFS)); // translate the data. BSWAP_STL_PA_IMAGE_ID(response); @@ -967,12 +970,12 @@ iba_pa_single_mad_move_freeze_response_query( } } - response = MemoryAllocate2AndClear(STL_PA_MOVE_FREEZE_NSIZE, IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); + response = MemoryAllocate2AndClear(sizeof(STL_MOVE_FREEZE_DATA), IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); if (response == NULL) { OMGT_OUTPUT_ERROR(port, "error allocating response buffer\n"); goto done; } - memcpy((uint8 *)response, rsp_mad->Data, min(STL_PA_MOVE_FREEZE_NSIZE, rcv_buf_len - IB_SA_DATA_OFFS)); + memcpy((uint8 *)response, rsp_mad->Data, min(sizeof(STL_MOVE_FREEZE_DATA), rcv_buf_len - IB_SA_DATA_OFFS)); // translate the data. BSWAP_STL_PA_MOVE_FREEZE(response); @@ -1031,12 +1034,12 @@ iba_pa_multi_mad_get_image_info_response_query ( } } - response = MemoryAllocate2AndClear(STL_PA_IMAGE_INFO_NSIZE, IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); + response = MemoryAllocate2AndClear(sizeof(STL_PA_IMAGE_INFO_DATA), IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); if (response == NULL) { OMGT_OUTPUT_ERROR(port, "error allocating response buffer\n"); goto done; } - memcpy((uint8 *)response, rsp_mad->Data, min(STL_PA_IMAGE_INFO_NSIZE, rcv_buf_len - IB_SA_DATA_OFFS)); + memcpy((uint8 *)response, rsp_mad->Data, min(sizeof(STL_PA_IMAGE_INFO_DATA), rcv_buf_len - IB_SA_DATA_OFFS)); // translate the data. BSWAP_STL_PA_IMAGE_INFO(response); @@ -1706,12 +1709,12 @@ iba_pa_single_mad_vf_port_counters_response_query( } } - response = MemoryAllocate2AndClear(STL_PA_VF_PORT_COUNTERS_NSIZE, IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); + response = MemoryAllocate2AndClear(sizeof(STL_PA_VF_PORT_COUNTERS_DATA), IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); if (response == NULL) { OMGT_OUTPUT_ERROR(port, "error allocating response buffer\n"); goto done; } - memcpy((uint8 *)response, rsp_mad->Data, min(STL_PA_VF_PORT_COUNTERS_NSIZE, rcv_buf_len - IB_SA_DATA_OFFS)); + memcpy((uint8 *)response, rsp_mad->Data, min(sizeof(STL_PA_VF_PORT_COUNTERS_DATA), rcv_buf_len - IB_SA_DATA_OFFS)); // translate the data. BSWAP_STL_PA_VF_PORT_COUNTERS(response); @@ -1769,12 +1772,12 @@ iba_pa_single_mad_clr_vf_port_counters_response_query( } } - response = MemoryAllocate2AndClear(STL_PA_CLR_VF_PORT_COUNTERS_NSIZE, IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); + response = MemoryAllocate2AndClear(sizeof(STL_PA_CLEAR_VF_PORT_COUNTERS_DATA), IBA_MEM_FLAG_PREMPTABLE, OMGT_MEMORY_TAG); if (response == NULL) { OMGT_OUTPUT_ERROR(port, "error allocating response buffer\n"); goto done; } - memcpy((uint8 *)response, rsp_mad->Data, min(STL_PA_CLR_VF_PORT_COUNTERS_NSIZE, rcv_buf_len - IB_SA_DATA_OFFS)); + memcpy((uint8 *)response, rsp_mad->Data, min(sizeof(STL_PA_CLEAR_VF_PORT_COUNTERS_DATA), rcv_buf_len - IB_SA_DATA_OFFS)); // translate the data. BSWAP_STL_PA_CLEAR_VF_PORT_COUNTERS(response); @@ -1918,11 +1921,11 @@ iba_pa_query_master_pm_lid(struct omgt_port *port) OMGT_DBGPRINT(port, "Got Service Records: records=%d\n", service_record_results->NumServiceRecords); for (i = 0; i < service_record_results->NumServiceRecords; ++i) { - if (PM_SERVICE_ID == service_record_results->ServiceRecords[i].RID.ServiceID) + if (STL_PM_SERVICE_ID == service_record_results->ServiceRecords[i].RID.ServiceID) { pmCount++; - if ((service_record_results->ServiceRecords[i].ServiceData8[0] >= PM_VERSION) && - (service_record_results->ServiceRecords[i].ServiceData8[1] == PM_MASTER)) + if ((service_record_results->ServiceRecords[i].ServiceData8[0] >= STL_PM_VERSION) && + (service_record_results->ServiceRecords[i].ServiceData8[1] == STL_PM_MASTER)) { OMGT_DBGPRINT(port, "This is the Primary PM.\n"); @@ -1936,7 +1939,7 @@ iba_pa_query_master_pm_lid(struct omgt_port *port) query.InputValue.IbPathRecord.PathRecord.PathRecord.DGID = service_record_results->ServiceRecords[i].RID.ServiceGID; query.InputValue.IbPathRecord.PathRecord.PathRecord.SGID = port->local_gid; - query.InputValue.IbPathRecord.PathRecord.PathRecord.ServiceID = PM_SERVICE_ID; + query.InputValue.IbPathRecord.PathRecord.PathRecord.ServiceID = STL_PM_SERVICE_ID; query.InputValue.IbPathRecord.PathRecord.ComponentMask = IB_MULTIPATH_RECORD_COMP_NUMBPATH | PR_COMPONENTMASK_SRV_ID | PR_COMPONENTMASK_DGID | PR_COMPONENTMASK_SGID; @@ -2036,31 +2039,29 @@ iba_pa_mad_status_msg( * PACLIENT_DOWN - initialization not successful/PaServer not available */ int -omgt_pa_client_connect(struct omgt_port *port) +omgt_pa_service_connect(struct omgt_port *port) { FSTATUS fstatus; int mclass = MCLASS_VFI_PM; struct omgt_class_args mgmt_class[2]; int err = 0; IB_PORT_ATTRIBUTES *attrib = NULL; - int pa_client_status = PACLIENT_DOWN; + int pa_client_status = OMGT_SERVICE_STATE_DOWN; fstatus = omgt_get_portguid(port->hfi_num, port->hfi_port_num, NULL, port, NULL, NULL, NULL, &attrib, NULL, NULL, NULL, NULL, NULL); - if (FSUCCESS == fstatus && attrib) - { + if (FSUCCESS == fstatus && attrib) { port->local_gid = attrib->GIDTable[0]; - } - else - { + } else { OMGT_OUTPUT_ERROR(port, "Could not get port guid: %s\n", iba_fstatus_msg(fstatus)); goto done; } - - if ((fstatus = iba_pa_query_master_pm_lid(port)) != FSUCCESS) - { + if ((fstatus = iba_pa_query_master_pm_lid(port)) != FSUCCESS) { OMGT_OUTPUT_ERROR(port, "Can't query primary PM LID!\n"); + if (fstatus == FUNAVAILABLE) { + pa_client_status = OMGT_SERVICE_STATE_UNAVAILABLE; + } goto done; } @@ -2072,23 +2073,22 @@ omgt_pa_client_connect(struct omgt_port *port) mgmt_class[0].is_responding_client = 0; mgmt_class[0].is_trap_client = 0; mgmt_class[0].is_report_client = 0; - mgmt_class[0].kernel_rmpp = 1; // TODO: determine if this should be 0 + mgmt_class[0].kernel_rmpp = 1; mgmt_class[0].use_methods = 0; mgmt_class[0].oui = ib_truescale_oui; - if ((err = omgt_bind_classes(port, mgmt_class)) != 0) - { + if ((err = omgt_bind_classes(port, mgmt_class)) != 0) { OMGT_OUTPUT_ERROR(port, "Failed to register management class 0x%02x: %s\n", - mclass, strerror(err)); + mclass, strerror(err)); goto done; } - pa_client_status = PACLIENT_OPERATIONAL; + pa_client_status = OMGT_SERVICE_STATE_OPERATIONAL; done: if (attrib) MemoryDeallocate(attrib); - return (port->pa_client_state = pa_client_status); + return (port->pa_service_state = pa_client_status); } /** @@ -2210,7 +2210,7 @@ omgt_pa_get_image_info( memcpy(pm_image_info, response, sizeof(*pm_image_info)); for (ix = pm_image_info->numSMs; ix < 2; ix++) - memset(&pm_image_info->SMInfo[ix], 0, sizeof(SMINFO_DATA)); + memset(&pm_image_info->SMInfo[ix], 0, sizeof(STL_SMINFO_DATA)); MemoryDeallocate(response); fstatus = OMGT_STATUS_SUCCESS; diff --git a/opamgt/src/opamgt_sa.c b/opamgt/src/opamgt_sa.c index b4a16663..7a16437b 100644 --- a/opamgt/src/opamgt_sa.c +++ b/opamgt/src/opamgt_sa.c @@ -1,6 +1,6 @@ /* BEGIN_ICS_COPYRIGHT2 **************************************** -Copyright (c) 2015, Intel Corporation +Copyright (c) 2015-2017, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -38,8 +38,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define OPAMGT_PRIVATE 1 #include "iba/stl_sd.h" +#include "iba/stl_sa_priv.h" #include "ib_mad.h" -#include "ib_sm.h" +#include "ib_sm_priv.h" +#include "ib_generalServices.h" #include "ib_utils_openib.h" #include "opamgt_sa_priv.h" #include @@ -147,7 +149,8 @@ static const char* const SdQueryStlResultTypeText[] = { "OutputTypeStlSCVLntTableRecord", "OutputTypeStlSCSCTableRecord", "OutputTypeStlClassPortInfo", - "OutputTypeStlFabricInfoRecord" + "OutputTypeStlFabricInfoRecord", + "OutputTypeStlSwitchCostRecord" }; /* TBD get from libibt? */ @@ -289,9 +292,9 @@ static FSTATUS sa_query_common(SA_MAD * pSA, SA_MAD **ppRsp, uint32_t record_siz case SA_ATTRIB_PORTINFO_RECORD: if (pSA->common.BaseVersion != IB_BASE_VERSION) { fstatus = FPROTECTION; - break; + goto done; } - // fall through + // fall through case SA_ATTRIB_PATH_RECORD: case SA_ATTRIB_MULTIPATH_RECORD: case SA_ATTRIB_NODE_RECORD: @@ -306,40 +309,54 @@ static FSTATUS sa_query_common(SA_MAD * pSA, SA_MAD **ppRsp, uint32_t record_siz addr.pkey = 0x7fff; break; } - // fall through + // fall through default: // Unable to make such a query. // Must be full or limited mgmt, and we do not have proper pkey in our tables. fstatus = FPROTECTION; - break; + goto done; } } - if (fstatus!=FSUCCESS) { - goto done; + /* Set a short timeout for class port info as these queries will always be + * a small constant size. + */ + int timeout; + if (pSA->common.AttributeID == SA_ATTRIB_CLASS_PORT_INFO && port->sa_service_state != OMGT_SERVICE_STATE_OPERATIONAL) { + timeout = 250; //250 ms + } else { + timeout = port->ms_timeout; } BSWAP_SA_HDR (&pSA->SaHdr); BSWAP_MAD_HEADER((MAD*)pSA); fstatus = omgt_send_recv_mad_alloc(port, (uint8_t *)pSA, record_size + sizeof(MAD_COMMON) + sizeof(SA_MAD_HDR), - &addr, (uint8_t **)ppRsp, &length, DEFAULT_SD_TIMEOUT, DEFAULT_SD_RETRY_COUNT); + &addr, (uint8_t **)ppRsp, &length, timeout, port->retry_count); if (fstatus != FSUCCESS) { OMGT_DBGPRINT(port, "Query SA failed to send: %d\n", fstatus); goto done; } - - if (length < IBA_SUBN_ADM_HDRSIZE) { - OMGT_DBGPRINT(port, "Query SA: Failed to receive packet\n"); + /* Check if MAD header is present */ + if (length < sizeof(MAD_COMMON)) { + OMGT_DBGPRINT(port, "Query SA: Failed to receive packet: length (%zu) less than sizeof(MAD_COMMON) (%zu)\n", + length, sizeof(MAD_COMMON)); fstatus = FNOT_FOUND; goto done; } - - // Fix endian of the received data BSWAP_MAD_HEADER((MAD*)(*ppRsp)); - BSWAP_SA_HDR (&(*ppRsp)->SaHdr); MAD_GET_STATUS((*ppRsp), &madStatus); + port->sa_mad_status = madStatus.AsReg16; + + /* Check if SA Header is present */ + if (length < IBA_SUBN_ADM_HDRSIZE) { + OMGT_DBGPRINT(port, "Query SA: Failed to receive packet: length (%zu) less than IBA_SUBN_ADM_HDRSIZE (%u)\n", + length, IBA_SUBN_ADM_HDRSIZE); + fstatus = FNOT_FOUND; + goto done; + } + BSWAP_SA_HDR (&(*ppRsp)->SaHdr); // dump of SA header for debug OMGT_DBGPRINT(port, " SA Header\n"); @@ -393,7 +410,6 @@ static FSTATUS sa_query_common(SA_MAD * pSA, SA_MAD **ppRsp, uint32_t record_siz (*ppQR)->ResultDataSize = record_size * cnt; *((uint32_t*)((*ppQR)->QueryResult)) = cnt; - port->sa_mad_status = madStatus.AsReg16; done: if (fstatus != FSUCCESS) { if (*ppRsp!=NULL) { @@ -811,20 +827,6 @@ FSTATUS omgt_input_value_conversion(OMGT_QUERY *output_query, QUERY_INPUT_VALUE default: return FNOT_FOUND; } break; -#ifndef NO_STL_SERVICE_OUTPUT - case OutputTypeStlServiceRecord: - switch (output_query->InputType) { - case InputTypeNoInput: break; - case InputTypeLid: - output_query->InputValue.StlServiceRecord.Lid = old_query->Lid; - break; - case InputTypePortGid: - output_query->InputValue.StlServiceRecord.ServiceGid = old_query->Gid; - break; - default: return FNOT_FOUND; - } - break; -#endif #ifndef NO_STL_MCMEMBER_OUTPUT case OutputTypeStlMcMemberRecord: switch (output_query->InputType) { @@ -841,6 +843,9 @@ FSTATUS omgt_input_value_conversion(OMGT_QUERY *output_query, QUERY_INPUT_VALUE case InputTypePKey: output_query->InputValue.StlMcMemberRecord.PKey = old_query->PKey; break; + case InputTypeSL: + output_query->InputValue.StlMcMemberRecord.SL = old_query->SL; + break; default: return FNOT_FOUND; } break; @@ -860,6 +865,9 @@ FSTATUS omgt_input_value_conversion(OMGT_QUERY *output_query, QUERY_INPUT_VALUE case InputTypePKey: output_query->InputValue.IbMcMemberRecord.PKey = old_query->PKey; break; + case InputTypeSL: + output_query->InputValue.IbMcMemberRecord.SL = old_query->SL; + break; default: return FNOT_FOUND; } break; @@ -1060,6 +1068,15 @@ FSTATUS omgt_input_value_conversion(OMGT_QUERY *output_query, QUERY_INPUT_VALUE default: return FNOT_FOUND; } break; + case OutputTypeStlSwitchCostRecord: + switch (output_query->InputType) { + case InputTypeNoInput: break; + case InputTypeLid: + output_query->InputValue.SwitchCostRecord.Lid = old_query->Lid; + break; + default: return FNOT_FOUND; + } + break; default: return FNOT_FOUND; } return FSUCCESS; @@ -1076,7 +1093,7 @@ FSTATUS omgt_input_value_conversion(OMGT_QUERY *output_query, QUERY_INPUT_VALUE * * @return 0 if success, else error code */ -FSTATUS omgt_query_sa(struct omgt_port *port, OMGT_QUERY *pQuery, +static FSTATUS omgt_query_sa_internal(struct omgt_port *port, OMGT_QUERY *pQuery, struct _QUERY_RESULT_VALUES **ppQueryResult) { FSTATUS fstatus = FSUCCESS; @@ -1790,50 +1807,6 @@ FSTATUS omgt_query_sa(struct omgt_port *port, OMGT_QUERY *pQuery, } break; -#ifndef NO_STL_SERVICE_OUTPUT // Don't output STL Service if defined - case OutputTypeStlServiceRecord: - { - STL_SERVICE_RECORD_RESULTS *pSRR; - STL_SERVICE_RECORD *pSR = (STL_SERVICE_RECORD*)mad.Data; - - switch (pQuery->InputType) { - case InputTypeNoInput: - break; - case InputTypeLid: - mad.SaHdr.ComponentMask = STL_SERVICE_RECORD_COMP_SERVICELID; - pSR->RID.ServiceGID = pQuery->InputValue.StlServiceRecord.Lid; - break; - case InputTypePortGid: - mad.SaHdr.ComponentMask = STL_SERVICE_RECORD_COMP_SERVICEGID; - pSR->RID.ServiceGID = pQuery->InputValue.StlServiceRecord.ServiceGid; - break; - default: - OMGT_OUTPUT_ERROR(port, "Query not supported by opamgt: Input=%s, Output=%s\n", - iba_sd_query_input_type_msg(pQuery->InputType), - iba_sd_query_result_type_msg(pQuery->OutputType)); - fstatus = FINVALID_PARAMETER; goto done; - } - - pSR->RID.Reserved = 0; - pSR->Reserved = 0; - - BSWAP_STL_SERVICE_RECORD(pSR); - MAD_SET_ATTRIB_ID(&mad, STL_SA_ATTR_SERVICE_RECORD); - - fstatus = sa_query_common(&mad, &pRsp, sizeof (STL_SERVICE_RECORD), &pQR, port); - if (fstatus != FSUCCESS) break; - - // Translate the data. - pSRR = (STL_SERVICE_RECORD_RESULTS*)pQR->QueryResult; - pSR = pSRR->ServiceRecords; - for (i=0; i< pSRR->NumServiceRecords; i++, pSR++) { - *pSR = * ((STL_SERVICE_RECORD*)(GET_RESULT_OFFSET(pRsp, i))); - BSWAP_STL_SERVICE_RECORD(pSR); - } - } - break; -#endif - #ifndef NO_STL_MCMEMBER_OUTPUT // Don't output STL McMember (use IB format) if defined case OutputTypeStlMcMemberRecord: { @@ -1859,6 +1832,10 @@ FSTATUS omgt_query_sa(struct omgt_port *port, OMGT_QUERY *pQuery, mad.SaHdr.ComponentMask = STL_MCMEMBER_COMPONENTMASK_PKEY; pMCR->P_Key = pQuery->InputValue.StlMcMemberRecord.PKey; break; + case InputTypeSL: + mad.SaHdr.ComponentMask = STL_MCMEMBER_COMPONENTMASK_SL; + pMCR->SL = pQuery->InputValue.StlMcMemberRecord.SL; + break; default: OMGT_OUTPUT_ERROR(port, "Query not supported by opamgt: Input=%s, Output=%s\n", iba_sd_query_input_type_msg(pQuery->InputType), @@ -1913,6 +1890,10 @@ FSTATUS omgt_query_sa(struct omgt_port *port, OMGT_QUERY *pQuery, mad.SaHdr.ComponentMask = IB_MCMEMBER_RECORD_COMP_PKEY; pIbMCR->P_Key = pQuery->InputValue.IbMcMemberRecord.PKey; break; + case InputTypeSL: + mad.SaHdr.ComponentMask = IB_MCMEMBER_RECORD_COMP_SL; + pIbMCR->u1.s.SL = pQuery->InputValue.IbMcMemberRecord.SL; + break; default: OMGT_OUTPUT_ERROR(port, "Query not supported by opamgt: Input=%s, Output=%s\n", iba_sd_query_input_type_msg(pQuery->InputType), @@ -2811,7 +2792,7 @@ FSTATUS omgt_query_sa(struct omgt_port *port, OMGT_QUERY *pQuery, // Translate the data pRecResults = (STL_PORT_GROUP_FORWARDING_TABLE_RECORD_RESULTS*)pQR->QueryResult; pRec = pRecResults->Records; - + for(i = 0; i < pRecResults->NumRecords; i++, pRec++) { *pRec = * ((STL_PORT_GROUP_FORWARDING_TABLE_RECORD*)(GET_RESULT_OFFSET(pRsp, i))); @@ -2820,6 +2801,42 @@ FSTATUS omgt_query_sa(struct omgt_port *port, OMGT_QUERY *pQuery, break; } + case OutputTypeStlSwitchCostRecord: + { + STL_SWITCH_COST_RECORD_RESULTS *pSCR; + STL_SWITCH_COST_RECORD *pSC = (STL_SWITCH_COST_RECORD *)mad.Data; + + switch(pQuery->InputType) { + case InputTypeNoInput: + break; + case InputTypeLid: + mad.SaHdr.ComponentMask = STL_SWITCH_COST_REC_COMP_SLID; + pSC->SLID = pQuery->InputValue.SwitchCostRecord.Lid; + break; + default: + OMGT_OUTPUT_ERROR(port, "Query not supported by opamgt: Input=%s, Output=%s\n", + iba_sd_query_input_type_msg(pQuery->InputType), + iba_sd_query_result_type_msg(pQuery->OutputType)); + fstatus = FINVALID_PARAMETER; goto done; + } + + BSWAP_STL_SWITCH_COST_RECORD(pSC); + MAD_SET_ATTRIB_ID(&mad, STL_SA_ATTR_SWITCH_COST_RECORD); + + fstatus = sa_query_common(&mad, &pRsp, sizeof(STL_SWITCH_COST_RECORD), &pQR, port); + if(fstatus != FSUCCESS) break; + + pSCR = (STL_SWITCH_COST_RECORD_RESULTS*)pQR->QueryResult; + pSC = pSCR->Records; + + for(i = 0; i < pSCR->NumRecords; ++i, ++pSC) + { + *pSC = *((STL_SWITCH_COST_RECORD*)(GET_RESULT_OFFSET(pRsp, i))); + BSWAP_STL_SWITCH_COST_RECORD(pSC); + } + break; + } + default: OMGT_OUTPUT_ERROR(port, "Query not supported by opamgt: Input=%s, Output=%s\n", iba_sd_query_input_type_msg(pQuery->InputType), @@ -2844,6 +2861,62 @@ FSTATUS omgt_query_sa(struct omgt_port *port, OMGT_QUERY *pQuery, return fstatus; } +/* omgt_query_sa + * + * All SA queries are sent through this path. This function performs a test of + * SA reachability before sending the main query. If the FM's reachability is + * not operational, a request for a ClassPortInfo with a small timeout + * (defaulted to 250ms in lower layer) is sent. Only after determining the SA + * is reachable is the main query sent. All other queries currently default to + * a timeout of 20s with 3 retires. Sending the CPI first allows us to do a + * quick ping and avoid long timeouts when SA is unreachable. + * + * if pQuery and ppQueryResult are input NULL, only a reachability test will be + * performed with no main query. + * + */ +FSTATUS omgt_query_sa(struct omgt_port *port, OMGT_QUERY *pQuery, + struct _QUERY_RESULT_VALUES **ppQueryResult) +{ + FSTATUS fstatus = FSUCCESS; + if (port == NULL) + return FINVALID_PARAMETER; + + if (port->sa_service_state != OMGT_SERVICE_STATE_OPERATIONAL && !port->is_oob_enabled) { + QUERY_RESULT_VALUES *cpi_query_result = NULL; + OMGT_QUERY cpi_query; + cpi_query.InputType = InputTypeNoInput; + cpi_query.OutputType = OutputTypeStlClassPortInfo; + fstatus = omgt_query_sa_internal(port, &cpi_query, &cpi_query_result); + + if (fstatus == FSUCCESS) { + port->sa_service_state = OMGT_SERVICE_STATE_OPERATIONAL; + if (pQuery != NULL && ppQueryResult != NULL && + pQuery->OutputType == OutputTypeStlClassPortInfo && + pQuery->InputType == InputTypeNoInput && cpi_query_result != NULL) { + /* If request is a ClassPortInfo Query, then just return with results */ + *ppQueryResult = cpi_query_result; + return FSUCCESS; + } + } else { + OMGT_OUTPUT_ERROR(port, "SA Service State refresh failed: %u. Marking SA and PA Service State DOWN\n", fstatus); + port->sa_service_state = OMGT_SERVICE_STATE_DOWN; + /* If SA is down assume PA is down */ + port->pa_service_state = OMGT_SERVICE_STATE_DOWN; + } + omgt_free_query_result_buffer(cpi_query_result); + } + if (fstatus == FSUCCESS && pQuery != NULL && ppQueryResult != NULL) { + fstatus = omgt_query_sa_internal(port, pQuery, ppQueryResult); + if (fstatus != FSUCCESS) { + OMGT_OUTPUT_ERROR(port, "Query Failed: %u. Marking SA and PA Service State DOWN\n", fstatus); + port->sa_service_state = OMGT_SERVICE_STATE_DOWN; + /* If SA is down assume PA is down */ + port->pa_service_state = OMGT_SERVICE_STATE_DOWN; + } + } + return fstatus; +} diff --git a/opamgt/src/opamgt_sa_notice.c b/opamgt/src/opamgt_sa_notice.c new file mode 100644 index 00000000..76909543 --- /dev/null +++ b/opamgt/src/opamgt_sa_notice.c @@ -0,0 +1,203 @@ +/* BEGIN_ICS_COPYRIGHT2 **************************************** + +Copyright (c) 2015, Intel Corporation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +** END_ICS_COPYRIGHT2 ****************************************/ + +/* [ICS VERSION STRING: unknown] */ + +#include +#include +#include /* strerror() */ + + +#define OPAMGT_PRIVATE 1 +#include "ib_utils_openib.h" + +#include +#include +#include +#include + + +/**===========================================================================*/ +omgt_sa_registration_t* omgt_sa_find_reg(struct omgt_port *port, uint16_t trap_num) +{ + omgt_sa_registration_t *curr = port->regs_list; + while (curr != NULL) { + if (curr->trap_num == trap_num) { + return curr; + } + curr = curr->next; + } + return NULL; +} +/**===========================================================================*/ +OMGT_STATUS_T omgt_sa_register_trap(struct omgt_port *port, uint16_t trap_num, + void *context) +{ + OMGT_STATUS_T status; + int ret; + omgt_sa_registration_t *reg; + + reg = (omgt_sa_registration_t *)calloc(1, sizeof*reg); + if (reg == NULL) { + OMGT_OUTPUT_ERROR(port, "failed to allocate reg structure\n"); + return OMGT_STATUS_ERROR; + } + + status = FTIMEOUT; + if (omgt_lock_sem(&port->lock)) { + OMGT_OUTPUT_ERROR(port, "failed to acquire lock (status: %d)\n", status); + free(reg); + return OMGT_STATUS_ERROR; + } + + if (omgt_sa_find_reg(port, trap_num)) { + omgt_unlock_sem(&port->lock); + free(reg); + return OMGT_STATUS_SUCCESS; + } + + if ((ret = create_sa_qp(port)) != 0) { + omgt_unlock_sem(&port->lock); + OMGT_OUTPUT_ERROR(port, "failed to create notice QP for trap (%u) registration (status: %d)\n", + trap_num, ret); + } else if ((ret = userspace_register(port, trap_num, reg)) != 0) { + omgt_unlock_sem(&port->lock); + OMGT_OUTPUT_ERROR(port, "failed to register for trap (%u) (status: %d)\n", + trap_num, ret); + } + + if (ret) { + free(reg); + return OMGT_STATUS_ERROR; + } + + reg->user_context = context; + reg->trap_num = trap_num; + omgt_sa_add_reg_unsafe(port, reg); + + omgt_unlock_sem(&port->lock); + return OMGT_STATUS_SUCCESS; +} +/**===========================================================================*/ +OMGT_STATUS_T omgt_sa_unregister_trap(struct omgt_port *port, uint16_t trap_num) +{ + OMGT_STATUS_T status; + + if (omgt_lock_sem(&port->lock)) + return OMGT_STATUS_ERROR; + + status = omgt_sa_remove_reg_by_trap_unsafe(port, trap_num); + + omgt_unlock_sem(&port->lock); + return status; +} +/**===========================================================================*/ +OMGT_STATUS_T omgt_sa_get_notice_report(struct omgt_port *port, STL_NOTICE **notice, + size_t *notice_len, void **context, int poll_timeout_ms) +{ + int rc; + int bytes_read; + struct pollfd pollfd[1]; + uint8_t rcv_buf[2048]; + struct omgt_thread_msg *msg; + STL_NOTICE *notice_buf = NULL; + omgt_sa_registration_t *reg; + uint16_t trap_num; + + pollfd[0].fd = port->umad_port_sv[0]; + pollfd[0].events = POLLIN; + pollfd[0].revents = 0; + + /* Poll for event */ + if ((rc = poll(pollfd, 1, poll_timeout_ms)) < 0) { + OMGT_OUTPUT_ERROR(port, "trap poll failed : %s\n", strerror(errno)); + return FERROR; + + } else if (rc == 0) { + /* Handle Timeout Case */ + return OMGT_STATUS_TIMEOUT; + } else if (pollfd[0].revents & POLLIN) { + /* Read from Stream */ + bytes_read = read(port->umad_port_sv[0], rcv_buf, sizeof(rcv_buf)); + if (bytes_read <= 0) { + OMGT_OUTPUT_ERROR(port, "user event read failed : %s\n", strerror(errno)); + return OMGT_STATUS_ERROR; + } + + /* Determine Message Type */ + msg = (struct omgt_thread_msg *)rcv_buf; + if (OMGT_TH_EVT_TRAP_MSG == msg->evt) { + /* Thread Event Type : Trap Message */ + + /* Allocate the Notice */ + notice_buf = (STL_NOTICE *)calloc(1, msg->size); + if (notice_buf == NULL) { + OMGT_OUTPUT_ERROR(port, "failed to allocate notice buffer\n"); + return OMGT_STATUS_INSUFFICIENT_MEMORY; + } + /* Copy and allocate the Data */ + memcpy(notice_buf, rcv_buf + sizeof(*msg), msg->size); + BSWAP_STL_NOTICE(notice_buf); + trap_num = notice_buf->Attributes.Generic.TrapNumber; + OMGT_DBGPRINT(port, "trap message %u: %d bytes\n", trap_num, (int)(msg->size)); + + /* Find Context */ + if (context) { + reg = omgt_sa_find_reg(port, trap_num); + if (reg == NULL) { + OMGT_OUTPUT_ERROR(port, "failed to retrieve registration: trap %u\n", trap_num); + *context = NULL; + } else { + /* Set context */ + *context = reg->user_context; + } + } + + /* Set Notice struct and length */ + *notice = notice_buf; + *notice_len = msg->size; + return OMGT_STATUS_SUCCESS; + + } else if (OMGT_TH_EVT_TRAP_REG_ERR_TIMEOUT == msg->evt) { + /* Thread Event Type : Registration Timeout */ + STL_INFORM_INFO *informinfo = (STL_INFORM_INFO *)msg->data; + trap_num = ntoh16(informinfo->u.Generic.TrapNumber); + OMGT_OUTPUT_ERROR(port, "Registration of Trap message timed out: Trap %u\n", trap_num); + + return OMGT_STATUS_DISCONNECT; + } else { + OMGT_OUTPUT_ERROR(port, "user event read invalid message: %u\n", msg->evt); + return OMGT_STATUS_ERROR; + } + } else { + OMGT_OUTPUT_ERROR(port, "trap poll unexpected result : %d\n", pollfd[0].revents); + return OMGT_STATUS_ERROR; + } + return OMGT_STATUS_SUCCESS; +} \ No newline at end of file diff --git a/opamgt/src/opamgt_sa_query.c b/opamgt/src/opamgt_sa_query.c index d6ab2dd3..74f6e116 100644 --- a/opamgt/src/opamgt_sa_query.c +++ b/opamgt/src/opamgt_sa_query.c @@ -1931,4 +1931,55 @@ omgt_sa_get_portgroupfwd_records( return status; } +/** + * @brief Query SA for SwitchCost Records + * + * @param port port opened by omgt_open_port_* + * @param selector Criteria to select records. + * Valid InputType values: + * NoInput, Lid + * @param num_records Output: The number of records returned in query + * @param records Output: Pointer to records. + * Must be freed by calling omgt_sa_free_records + * + * @return OMGT_STATUS_SUCCESS if success, else error code + */ +OMGT_STATUS_T +omgt_sa_get_switchcost_records( + struct omgt_port *port, + omgt_sa_selector_t *selector, + int32_t *num_records, + STL_SWITCH_COST_RECORD **records + ) +{ + + OMGT_STATUS_T status; + QUERY_RESULT_VALUES *query_result; + STL_SWITCH_COST_RECORD_RESULTS *record_results = NULL; + + status = omgt_sa_query_helper(port, selector, OutputTypeStlSwitchCostRecord, &query_result); + + if (OMGT_STATUS_SUCCESS != status) + return status; + + record_results = (STL_SWITCH_COST_RECORD_RESULTS*)query_result->QueryResult; + *num_records = record_results->NumRecords; + if(*num_records == 0) { + *records = NULL; + goto exit; + } + + int buf_size = sizeof(**records) * (*num_records); + *records = malloc(buf_size); + if(*records == NULL){ + status = OMGT_STATUS_INSUFFICIENT_MEMORY; + goto exit; + } + + memcpy(*records, record_results->Records, buf_size); + +exit: + omgt_free_query_result_buffer(query_result); + return status; +} diff --git a/opamgt/src/stl_convertfuncs.c b/opamgt/src/stl_convertfuncs.c index 2a8dd594..056d432e 100644 --- a/opamgt/src/stl_convertfuncs.c +++ b/opamgt/src/stl_convertfuncs.c @@ -28,7 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ** END_ICS_COPYRIGHT5 ****************************************/ /* [ICS VERSION STRING: unknown] */ -#include "iba/stl_mad.h" +#include "iba/stl_mad_priv.h" #include "stl_convertfuncs.h" int stl_CopyIbNodeInfo(STL_NODE_INFO * dest, NODE_INFO * src, int cpyVerInfo) diff --git a/opamgt/src/stl_convertfuncs.h b/opamgt/src/stl_convertfuncs.h index 95931176..b02e8f1a 100644 --- a/opamgt/src/stl_convertfuncs.h +++ b/opamgt/src/stl_convertfuncs.h @@ -31,8 +31,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef _stl_convertfuncs_h_included_ #define _stl_convertfuncs_h_included_ 1 -#include "iba/ib_sm.h" -#include "iba/stl_sm.h" +#include "iba/ib_sm_priv.h" +#include "iba/stl_sm_priv.h" /** @file Provides functions for converting IB to STL data structures. diff --git a/opamgt/version b/opamgt/version index 6e8bf73a..0ea3a944 100644 --- a/opamgt/version +++ b/opamgt/version @@ -1 +1 @@ -0.1.0 +0.2.0