1 Star 0 Fork 0

missyoyo/libmoon

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
bind-interfaces.sh 2.61 KB
一键复制 编辑 原始数据 按行查看 历史
Paul Emmerich 提交于 2019-06-21 16:30 . update dpdk to 19.05
#!/bin/bash
MLX5=false
MLX4=false
while :; do
case $1 in
-h|--help)
echo "Usage: <no option> bind only to uio drivers; <-m|--mlx5> additionally bind ConnectX-4 (Lx) to mlx5_core; <-n|--mlx4> additionally bind ConnectX-3 Pro to mlx4_core; <-h|--help> help"
exit
;;
-m|--mlx5)
echo "Binding applicable NICs to mlx5_core"
MLX5=true
;;
-n|--mlx4)
echo "Binding applicable NICS to mlx4_core"
MLX4=true
;;
-?*)
printf 'WARN: Unknown option (abort): %s\n' "$1" >&2
exit
;;
*)
break
esac
shift
done
(
cd $(dirname "${BASH_SOURCE[0]}")
cd deps/dpdk
modprobe uio
(lsmod | grep igb_uio > /dev/null) || insmod ./x86_64-native-linux-gcc/kmod/igb_uio.ko
i=0
for id in $(usertools/dpdk-devbind.py --status | grep -v Active | grep -v ConnectX | grep unused=igb_uio | cut -f 1 -d " ")
do
echo "Binding interface $id to DPDK"
usertools/dpdk-devbind.py --bind=igb_uio $id
i=$(($i+1))
done
if $MLX5 ; then
modprobe -a ib_uverbs mlx5_core mlx5_ib
if [ $? -ne 0 ]; then
printf "WARN: Could not load mlx5 kernel modules. Try to load them manually by executing: modprobe -a ib_uverbs mlx5_core mlx5_ib" >&2
fi
for id in $(usertools/dpdk-devbind.py --status | grep -v Active | grep ConnectX-4 | cut -f 1 -d " ")
do
echo "Binding interface $id to DPDK (kernel module mlx5_core)"
usertools/dpdk-devbind.py --bind=mlx5_core $id
i=$(($i+1))
done
fi
if $MLX4 ; then
modprobe -a ib_uverbs mlx4_en mlx4_core mlx4_ib
if [ $? -ne 0 ]; then
printf "WARN: Could not load mlx5 kernel modules. Try to load them manually by executing: modprobe -a ib_uverbs mlx4_en mlx4_core mlx4_ib" >&2
fi
for id in $(usertools/dpdk-devbind.py --status | grep -v Active | grep ConnectX-3 | cut -f 1 -d " ")
do
echo "Binding interface $id to DPDK (kernel module mlx4_core)"
usertools/dpdk-devbind.py --bind=mlx4_core $id
i=$(($i+1))
done
fi
if [[ $i == 0 ]]
then
echo "Could not find any inactive interfaces to bind to DPDK. Note that this script does not bind interfaces that are in use by the OS."
echo "Delete IP addresses from interfaces you would like to use with libmoon and run this script again."
echo "You can also use the script dpdk-devbind.py in ${ERROR_MSG_SUBDIR}deps/dpdk/usertools manually to manage interfaces used by libmoon and the OS."
fi
)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Lua
1
https://gitee.com/missyoyo/libmoon.git
git@gitee.com:missyoyo/libmoon.git
missyoyo
libmoon
libmoon
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385