配置脚本
其中第一个变量是pci设备ID
第二个是MPS变量值(128、256、512、1024、2048、4096)
第三个是MRS变量值(128、256、512、1024、2048、4096)
例:
sh setmrs.sh 01:00.0 512 512
配置设备ID 01:00.0的MPS大小为512,MRS为512
if [ "$#" == "3" ]; then
if [[ "$2" == "128" ]];then
a="0f"
elif [[ "$2" == "256" ]];then
a="2f"
elif [[ "$2" == "512" ]];then
a="4f"
elif [[ "$2" == "1024" ]];then
a="6f"
elif [[ "$2" == "2048" ]];then
a="8f"
elif [[ "$2" == "4096" ]];then
a="9f"
else
echo "Fail"
exit
fi
if [[ "$3" == "128" ]];then
b="09"
elif [[ "$3" == "256" ]];then
b="19"
elif [[ "$3" == "512" ]];then
b="29"
elif [[ "$3" == "1024" ]];then
b="39"
elif [[ "$3" == "2048" ]];then
b="49"
elif [[ "$3" == "4096" ]];then
b="59"
else
echo "Fail"
exit
fi
echo "setpci -s "$1" CAP_EXP+08.W=0x"$b$a
setpci -s $1 CAP_EXP+08.W=0x$b$a
echo ""
echo "lspci -vvv -s "$1"|grep Max"
lspci -vvv -s $1|grep Max
else
echo "Fail"
fi