2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 17:46:38 +00:00

Add postscript to enable CAPI mode for mlnxofed

This commit is contained in:
Casandra Qiu 2018-04-05 09:39:56 -04:00
parent ac7864220a
commit c9dc4439ec

View File

@ -0,0 +1,92 @@
#!/bin/bash
if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then
str_dir_name=`dirname $0`
. $str_dir_name/xcatlib.sh
fi
#---------------------------------------------------------------------------
#=head1 enablecapi
#=head2 enable CAPI and tunnel Atomics for compute nodes
# at least MOFED 4.3.1 has to be installed and only support on ConnectX5
#
# updatenode <node> enablecapi
#
#---------------------------------------------------------------------------
#check if mlnx ofed installed
if [ ! -x /usr/bin/ofed_info ]; then
logger -t xcat -p local4.err "MOFED is not installed"
echo "MOFED is not installed on the system"
exit -1
fi
#mofed version at least 4.3-1
version=`/usr/bin/ofed_info -n`
majorversion=`echo $version | cut -d- -f1`
minorversion=`echo $version | cut -d- -f2`
if (( $(echo "$majorversion < 4.3" |bc -l) )); then
logger -t xcat -p local4.err "Current MOFED version is $version and needs to be at least 4.3-1"
echo "Current MOFED version is $version and needs to be at least 4.3-1"
exit -1
fi
if (( $(echo "$majorversion == 4.3" |bc -l) )); then
minor=`echo $minorversion | cut -d. -f1`
if (( $(echo "$minor < 1") )); then
logger -t xcat -p local4.err "MOFED version needs to be at least 4.3-1"
echo "Current MOFED version is $version and needs to be at least 4.3-1"
exit -1
fi
fi
#check if mst is existed
if [ ! -x /usr/bin/mst ]; then
logger -t xcat -p local4.err "mst command is not available"
echo "mst command is not available"
exit -1
fi
service mst restart >/dev/null 2>&1
if [ "$?" != "0" ] ;then
logger -t xcat -p local4.err "[Error] failed to start mst."
echo "[Error] failed to start mst."
exit -1
fi
#check if mlxconfig is existed
if [ ! -x /usr/bin/mlxconfig ]; then
logger -t xcat -p local4.err "mlxconfig command is not available"
echo "mlxconfig command is not available"
exit -1
fi
reboot_flag=0
for x in `ls /dev/mst/mt*`
do
mlxconfig -y -d $x q | grep 'ConnectX5' >/dev/null 2>&1
if [ $? == 0 ]; then
mlxconfig -y -d $x set ADVANCED_PCI_SETTINGS=true >/dev/null 2>&1
mlxconfig -y -d $x set IBM_CAPI_EN=true >/dev/null 2>&1
mlxconfig -y -d $x set IBM_TUNNELED_ATOMIC_EN=true >/dev/null 2>&1
mlxconfig -y -d $x set IBM_AS_NOTIFY_EN=true >/dev/null 2>&1
echo "Apply new Configuration for $x:"
mlxconfig -y -d $x q | grep 'IBM'
reboot_flag=1
fi
done
if [[ $reboot_flag == 0 ]]; then
echo "Didn't find ConnectX5 Devices, will not apply the new configuration"
fi
if [[ $reboot_flag == 1 ]]; then
echo "******************************************************"
echo " New configuration applied"
echo " Please reboot system to load new configurations"
echo "******************************************************"
fi
exit 0