blob: 294195327aae5c28f0cfbbb17390f9245ea8ff6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
function portset {
pci=$1
mode=$2
./connectx_port_config -d "$pci" -c "$mode,$mode" &> /dev/null
}
function mlxconf {
mode=$1
pci=$(./connectx_port_config -s | grep PCI | grep -Po "\d{4}:\d{2}:\d{2}\.\d")
for dev in $pci; do
echo "Configuring: $dev"
portset $dev $mode
done
}
function ipset {
int="$1"
ip="$2"
if [ -n "$ip" ]; then
ip link set "$int" up
ip addr flush "$int"
ip addr show dev "$int" | grep "$ip" || ip addr add "$ip/24" dev "$int"
else
ip addr flush "$int"
ip link set "$int" down
fi
}
|