Skip to content

Commit b4331f2

Browse files
rootwaleedm
authored andcommitted
Adding support for IPoIb interfaces
The patch allow to ifup/ifdown IpoIB interfaces from network-scripts The required config is the following DEVICE=ib0.8005 # ib0 the it IB interface TYPE=Infiniband # the type is Infiniband PKEY=yes # indicator that it's IPoIB interface PKEY_ID=5 # the pkey number
1 parent a6a54d0 commit b4331f2

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

network-scripts/ifdown

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ if [ ! -x ${OTHERSCRIPT} ]; then
7171
fi
7272

7373
if [ ! -x ${OTHERSCRIPT} ]; then
74-
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-eth"
74+
if is_true "${PKEY}" && [ "${TYPE}" = "Infiniband" ] ; then
75+
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-ib"
76+
else
77+
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-eth"
78+
fi
7579
fi
7680

7781
exec ${OTHERSCRIPT} ${CONFIG} $2

network-scripts/ifdown-ib

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
cd /etc/sysconfig/network-scripts
4+
. ./network-functions
5+
CONFIG=${1}
6+
source_config
7+
8+
if is_true "${PKEY}" && [ "${TYPE}" = "Infiniband" ] ; then
9+
# IPoIB support
10+
if [ -d /sys/devices/virtual/net/${DEVICE} ]; then
11+
ip link del "${DEVICE}"
12+
fi
13+
fi
14+
exit 0

network-scripts/ifup

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,29 @@ if is_true "${VLAN}" && is_false "$ISALIAS" && [ -n "$DEVICE" ]; then
149149
--prefix "/proc/sys/net/ipv6/conf/${DEVICE}"
150150
fi
151151

152+
# IPoIB support
153+
if is_true "${PKEY}" && [ "${TYPE}" = "Infiniband" ] ; then
154+
MATCH='^.+\.[0-9]{1,4}$'
155+
if [[ "${DEVICE}" =~ $MATCH ]]; then
156+
PHYSDEV=${DEVICE%.*}
157+
fi
158+
if ! modprobe ib_ipoib >/dev/null 2>&1 ; then
159+
net_log $"No IPoIB support available in kernel for device ${DEVICE}"
160+
exit 1
161+
fi
162+
if [ -d /sys/devices/virtual/net/${DEVICE} ]; then
163+
check_device_down ${DEVICE} && { ip -o link set dev ${DEVICE} up; }
164+
else
165+
ip link add dev ${DEVICE} link ${PHYSDEV} type ipoib pkey ${PKEY_ID} || {
166+
(/usr/bin/logger -p daemon.info -t ifup \$"ERROR: could not add
167+
pkey ${PKEY_ID} as ${DEVICE} on dev ${PHYSDEV}" &) &
168+
net_log $"ERROR: could not add pkey ${PKEY_ID} as ${DEVICE} on dev ${PHYSDEV}"
169+
exit 1
170+
}
171+
fi
172+
exit 0
173+
fi
174+
152175
if [ "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ]; then
153176
DYNCONFIG=true
154177
fi

0 commit comments

Comments
 (0)