1 |
alexxy 11/06/30 22:02:03 |
2 |
|
3 |
Added: 90-ib.rules openib.conf openib.env openib |
4 |
openib.modprobe |
5 |
Log: |
6 |
[sys-infiniband/openib-files] Initial import to tree |
7 |
|
8 |
(Portage version: 2.2.0_alpha41/cvs/Linux x86_64) |
9 |
|
10 |
Revision Changes Path |
11 |
1.1 sys-infiniband/openib-files/files/90-ib.rules |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-infiniband/openib-files/files/90-ib.rules?rev=1.1&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-infiniband/openib-files/files/90-ib.rules?rev=1.1&content-type=text/plain |
15 |
|
16 |
Index: 90-ib.rules |
17 |
=================================================================== |
18 |
KERNEL=="umad*", NAME="infiniband/%k" |
19 |
KERNEL=="issm*", NAME="infiniband/%k" |
20 |
KERNEL=="uverbs*", NAME="infiniband/%k", MODE="0666" |
21 |
KERNEL=="ucm*", NAME="infiniband/%k", MODE="0666" |
22 |
KERNEL=="rdma_cm", NAME="infiniband/%k", MODE="0666" |
23 |
|
24 |
|
25 |
|
26 |
1.1 sys-infiniband/openib-files/files/openib.conf |
27 |
|
28 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-infiniband/openib-files/files/openib.conf?rev=1.1&view=markup |
29 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-infiniband/openib-files/files/openib.conf?rev=1.1&content-type=text/plain |
30 |
|
31 |
Index: openib.conf |
32 |
=================================================================== |
33 |
# uncomment to load ib_ipoib module |
34 |
#IPOIB_LOAD=yes |
35 |
|
36 |
# uncomment to load ib_sdp module (implies IPOIB_LOAD=yes) |
37 |
#SDP_LOAD=yes |
38 |
|
39 |
# uncomment to load ib_srp module |
40 |
#SRP_LOAD=yes |
41 |
|
42 |
# uncomment to load ib_srp_target module |
43 |
#SRP_TARGET_LOAD=yes |
44 |
|
45 |
# uncomment to load rdma_cm module |
46 |
#RDMA_CM_LOAD=yes |
47 |
|
48 |
# uncomment to load ib_ucm module |
49 |
#UCM_LOAD=yes |
50 |
|
51 |
# uncomment to load ib_rds module |
52 |
#RDS_LOAD=yes |
53 |
|
54 |
# uncomment to load ib_iser module |
55 |
#ISER_LOAD=yes |
56 |
|
57 |
# uncomment to load rdma_ucm module |
58 |
#RDMA_UCM_LOAD=yes |
59 |
|
60 |
|
61 |
|
62 |
|
63 |
1.1 sys-infiniband/openib-files/files/openib.env |
64 |
|
65 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-infiniband/openib-files/files/openib.env?rev=1.1&view=markup |
66 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-infiniband/openib-files/files/openib.env?rev=1.1&content-type=text/plain |
67 |
|
68 |
Index: openib.env |
69 |
=================================================================== |
70 |
IBPATH="/usr/sbin" |
71 |
|
72 |
|
73 |
|
74 |
1.1 sys-infiniband/openib-files/files/openib |
75 |
|
76 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-infiniband/openib-files/files/openib?rev=1.1&view=markup |
77 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-infiniband/openib-files/files/openib?rev=1.1&content-type=text/plain |
78 |
|
79 |
Index: openib |
80 |
=================================================================== |
81 |
#!/sbin/runscript |
82 |
# Copyright 1999-2011 Gentoo Foundation |
83 |
# Distributed under the terms of the GNU General Public License v2 |
84 |
# $Header: /var/cvsroot/gentoo-x86/sys-infiniband/openib-files/files/openib,v 1.1 2011/06/30 22:02:03 alexxy Exp $ |
85 |
|
86 |
# Based on openibd script from openfabrics.org, |
87 |
# Copyright (c) 2006 Mellanox Technologies. All rights reserved. |
88 |
# Distributed under the terms of the GNU General Public License v2 |
89 |
|
90 |
depend() { |
91 |
after hotplug |
92 |
before net # init openib before starting any ipoib interfaces |
93 |
} |
94 |
|
95 |
OPENIB_CONFDIR=${OPENIB_CONFDIR:-/etc/infiniband} |
96 |
|
97 |
if [[ -r ${OPENIB_CONFDIR}/openib.conf ]] ; then |
98 |
. ${OPENIB_CONFDIR}/openib.conf |
99 |
fi |
100 |
|
101 |
# Setting OpenIB start parameters |
102 |
POST_LOAD_MODULES="" |
103 |
|
104 |
if [ "X${SDP_LOAD}" == "Xyes" ]; then |
105 |
POST_LOAD_MODULES="$POST_LOAD_MODULES ib_sdp" |
106 |
IPOIB_LOAD="yes" |
107 |
fi |
108 |
|
109 |
IPOIB=0 |
110 |
if [ "X${IPOIB_LOAD}" == "Xyes" ]; then |
111 |
IPOIB=1 |
112 |
fi |
113 |
|
114 |
if [ "X${SRP_LOAD}" == "Xyes" ]; then |
115 |
POST_LOAD_MODULES="$POST_LOAD_MODULES ib_srp" |
116 |
fi |
117 |
|
118 |
if [ "X${SRP_TARGET_LOAD}" == "Xyes" ]; then |
119 |
POST_LOAD_MODULES="$POST_LOAD_MODULES ib_srp_target" |
120 |
fi |
121 |
|
122 |
if [ "X${RDMA_CM_LOAD}" == "Xyes" ]; then |
123 |
POST_LOAD_MODULES="$POST_LOAD_MODULES rdma_cm" |
124 |
fi |
125 |
|
126 |
if [ "X${UCM_LOAD}" == "Xyes" ]; then |
127 |
POST_LOAD_MODULES="$POST_LOAD_MODULES ib_ucm" |
128 |
fi |
129 |
|
130 |
if [ "X${RDS_LOAD}" == "Xyes" ]; then |
131 |
POST_LOAD_MODULES="$POST_LOAD_MODULES ib_rds" |
132 |
fi |
133 |
|
134 |
if [ "X${ISER_LOAD}" == "Xyes" ]; then |
135 |
POST_LOAD_MODULES="$POST_LOAD_MODULES ib_iser" |
136 |
fi |
137 |
|
138 |
if [ "X${RDMA_UCM_LOAD}" == "Xyes" ]; then |
139 |
POST_LOAD_MODULES="$POST_LOAD_MODULES rdma_ucm" |
140 |
fi |
141 |
|
142 |
PRE_UNLOAD_MODULES="ib_rds ib_ucm kdapl ib_srp_target scsi_target ib_srp ib_iser ib_sdp rdma_ucm rdma_cm ib_addr ib_cm ib_local_sa findex" |
143 |
|
144 |
# W/A for unloading modules |
145 |
POST_UNLOAD_MODULES="$PRE_UNLOAD_MODULES ib_ipoib ib_sa ib_uverbs ib_umad" |
146 |
# ib_mthca ib_ipath - don't unload unless they are in openib.conf |
147 |
[[ "${MTHCA_LOAD}" == "yes" ]] && \ |
148 |
POST_UNLOAD_MODULES="$POST_UNLOAD_MODULES ib_mthca" |
149 |
[[ "${IPATH_LOAD}" == "yes" ]] && \ |
150 |
POST_UNLOAD_MODULES="$POST_UNLOAD_MODULES ib_ipath ipath_core" |
151 |
|
152 |
[[ "${MTHCA_LOAD}" == "yes" || "${IPATH_LOAD}" == "yes" ]] && \ |
153 |
POST_UNLOAD_MODULES="$POST_UNLOAD_MODULES ib_mad ib_core" |
154 |
|
155 |
#STATUS_MODULES="rdma_ucm ib_rds ib_srp ib_sdp rdma_cm ib_addr ib_local_sa findex ib_ipoib ib_ipath ipath_core ib_mthca ib_uverbs ib_umad ib_ucm ib_sa ib_cm ib_mad ib_core" |
156 |
|
157 |
|
158 |
# If module $1 is loaded return - 0 else - 1 |
159 |
is_module() |
160 |
{ |
161 |
local RC |
162 |
|
163 |
/bin/lsmod | grep -w "$1" > /dev/null 2>&1 |
164 |
RC=$? |
165 |
|
166 |
return $RC |
167 |
} |
168 |
|
169 |
unload() |
170 |
{ |
171 |
# Unload module $1 |
172 |
if is_module $mod; then |
173 |
/sbin/modprobe -r $mod > /dev/null 2>&1 |
174 |
if [ $? -ne 0 ]; then |
175 |
# Try rmmod if modprobe failed: case that previous installation included more IB modules. |
176 |
/sbin/rmmod $mod > /dev/null 2>&1 |
177 |
if [ $? -ne 0 ]; then |
178 |
ewarn "Failed to unload $mod" |
179 |
return 1 |
180 |
fi |
181 |
fi |
182 |
fi |
183 |
} |
184 |
|
185 |
start() { |
186 |
local RC=0 |
187 |
ebegin "Initializing Infiniband" |
188 |
eindent |
189 |
|
190 |
# Load Mellanox HCA driver if explicitly requested |
191 |
# (however, it should be loaded automatically by udev) |
192 |
|
193 |
einfo "Loading HCA and Access Layer drivers" |
194 |
|
195 |
if [[ "${MTHCA_LOAD}" == "yes" ]]; then |
196 |
/sbin/modprobe ib_mthca > /dev/null 2>&1 |
197 |
RC=$[ $RC + $? ] |
198 |
fi |
199 |
if [[ "${IPATH_LOAD}" == "yes" ]]; then |
200 |
/sbin/modprobe ib_ipath > /dev/null 2>&1 |
201 |
RC=$[ $RC + $? ] |
202 |
fi |
203 |
|
204 |
# Add node description to sysfs |
205 |
IBSYSDIR="/sys/class/infiniband" |
206 |
if [ -d ${IBSYSDIR} ]; then |
207 |
declare -i hca_id=1 |
208 |
for hca in ${IBSYSDIR}/*; do |
209 |
if [ -e ${hca}/node_desc ]; then |
210 |
echo -n "$(hostname -s) HCA-${hca_id}" >> ${hca}/node_desc |
211 |
fi |
212 |
let hca_id++ |
213 |
done |
214 |
fi |
215 |
/sbin/modprobe ib_umad > /dev/null 2>&1 |
216 |
RC=$[ $RC + $? ] |
217 |
/sbin/modprobe ib_uverbs > /dev/null 2>&1 |
218 |
RC=$[ $RC + $? ] |
219 |
|
220 |
if [ $IPOIB -eq 1 ]; then |
221 |
# this section is not necessary if all ib-over-ib devices are |
222 |
# aliased properly in /etc/modules.d/openib |
223 |
einfo "loading ib_ipoib module" |
224 |
/sbin/modprobe ib_ipoib > /dev/null 2>&1 |
225 |
RC=$[ $RC + $? ] |
226 |
if (( ! RC )); then |
227 |
# start the ipoib devices automatically... |
228 |
# this is probably a bad idea (the concept is taken from the |
229 |
# original SUSE/Redhat-based initscript), and should be removed. |
230 |
# But it works, and is not enabled by default. So I leave it here |
231 |
# for second opinions. |
232 |
local ibdevs=`rc-status -u -nc |egrep 'net\.ib[0-9a-zA-Z]+.*stopped' | awk '{print $1}'` |
233 |
if [ -n "$ibdevs" ] ; then |
234 |
einfo "starting ipoib devices" |
235 |
for ibdev in $ibdevs; do |
236 |
/etc/init.d/$ibdev start |
237 |
done |
238 |
fi |
239 |
fi |
240 |
fi |
241 |
|
242 |
# Devices for ib_umad and ib_uverbs should now have been created. |
243 |
if [ ! -d /dev/infiniband/ ]; then |
244 |
eerror "udev failed to create '/dev/infiniband/' devices" |
245 |
RC=1 |
246 |
fi |
247 |
|
248 |
# Load configured modules |
249 |
if [ "$POST_LOAD_MODULES" != "" ]; then |
250 |
for mod in $POST_LOAD_MODULES |
251 |
do |
252 |
case $mod in |
253 |
ib_iser) |
254 |
# Voltaire requirement |
255 |
/sbin/modprobe --force-modversion $mod > /dev/null 2>&1 |
256 |
;; |
257 |
*) |
258 |
/sbin/modprobe $mod > /dev/null 2>&1 |
259 |
;; |
260 |
esac |
261 |
RC=$? |
262 |
[ $RC -ne 0 ] && eerror "Failed to load $mod" |
263 |
done |
264 |
fi |
265 |
|
266 |
eoutdent |
267 |
eend $RC |
268 |
} |
269 |
|
270 |
stop() { |
271 |
ebegin "Stopping Infiniband" |
272 |
local RC=0 |
273 |
|
274 |
# Check if applications which use infiniband are running |
275 |
local apps="opensm osmtest ibbs ibns" |
276 |
local pid |
277 |
|
278 |
for app in $apps |
279 |
do |
280 |
if ( ps -ef | grep $app | grep -v grep > /dev/null 2>&1 ); then |
281 |
eerror "Please stop $app and all applications running over InfiniBand" |
282 |
eend 1 |
283 |
return |
284 |
fi |
285 |
done |
286 |
|
287 |
if ! is_module ib_core; then |
288 |
einfo "HCA driver is not loaded" |
289 |
eend 0 |
290 |
return |
291 |
fi |
292 |
|
293 |
# Unload ULPs modules |
294 |
|
295 |
if [ "$PRE_UNLOAD_MODULES" != "" ]; then |
296 |
for mod in $PRE_UNLOAD_MODULES |
297 |
do |
298 |
unload $mod || { eend 1; return; } |
299 |
done |
300 |
fi |
301 |
|
302 |
# Remove srp_presistant_bind.sh before removing ib_srp module |
303 |
PID_SCRPT_TO_KILL=`ps -efww | grep srp_persistent | grep -v grep | awk '{print $2}'` |
304 |
if ! [ "$PID_SCRPT_TO_KILL" == "" ]; then |
305 |
PID_SLEEP_TO_KILL=`ps -efww | grep $PID_SCRPT_TO_KILL | grep sleep | awk '{print $2}'` |
306 |
kill -9 $PID_SCRPT_TO_KILL |
307 |
fi |
308 |
if ! [ "$PID_SLEEP_TO_KILL" == "" ]; then |
309 |
kill -9 $PID_SLEEP_TO_KILL |
310 |
fi |
311 |
|
312 |
# Unload OpenIB modules |
313 |
|
314 |
if [ "$POST_UNLOAD_MODULES" != "" ]; then |
315 |
for mod in $POST_UNLOAD_MODULES |
316 |
do |
317 |
unload $mod || RC=1 |
318 |
done |
319 |
fi |
320 |
|
321 |
eend $RC |
322 |
} |
323 |
|
324 |
|
325 |
|
326 |
|
327 |
1.1 sys-infiniband/openib-files/files/openib.modprobe |
328 |
|
329 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-infiniband/openib-files/files/openib.modprobe?rev=1.1&view=markup |
330 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-infiniband/openib-files/files/openib.modprobe?rev=1.1&content-type=text/plain |
331 |
|
332 |
Index: openib.modprobe |
333 |
=================================================================== |
334 |
# Setup aliases from ip-over-ib devices to the ip-over-ib kernel module. |
335 |
# Add to this list if you have more infiniband ports. Or you can set |
336 |
# IPOIB_LOAD=yes to have the ip-over-ib interfaces brought up by init.d/openib |
337 |
alias ib0 ib_ipoib |
338 |
alias ib1 ib_ipoib |
339 |
alias ib2 ib_ipoib |
340 |
alias ib3 ib_ipoib |
341 |
|
342 |
alias net-pf-27 ib_sdp |
343 |
|
344 |
#options ib_mthca msi_x=1 |