]> git.openfabrics.org - ~emulex/for-vlad/compat-rdma.git/commitdiff
Changes to ofed-mic script to better handle IPoIB interfaces vofed-3.12-1-rc1
authorPhil Cayton <phil.cayton@intel.com>
Tue, 19 Aug 2014 19:11:31 +0000 (12:11 -0700)
committerVladimir Sokolovsky <vlad@mellanox.com>
Wed, 20 Aug 2014 10:00:23 +0000 (13:00 +0300)
List IPoIB interfaces brought up on card following card name and
colon (:), ie mic0 : ib0 ib1

If IF on card fails to come up (ie ifup ib0 fails), print offending card
and interface, keep trying other interfaces.  If any IPoIB interfaces fail
to come up don't assume card does not exist and try other hostnames.

ofed_scripts/ofed-mic

index 4ad6b082ee7c10b3899c552629f3a9278bb8a99a..0f6d48750694cad1e9ec3075c9dcf620632cf63b 100755 (executable)
@@ -91,31 +91,39 @@ start_mic()
        # load ibscif first with any options:
        $ssh $1 /sbin/modprobe ibscif $ibscif_opt &&
        $ssh $1 /etc/init.d/ibmodules start &> /dev/null
-
-       errors+=$?
+       [ $? != 0 ] && return 1
 
        conf=/etc/mpss/ipoib.conf
        if [ -f "$conf" ]; then
                source "$conf"
                if [ "${ipoib_enabled}" == "yes" ] ; then
-                       once=0
-                       echo -n -\  
                        $ssh $1 modprobe ib_ipoib ${ipoib_parms}
+                       [ $? != 0 ] && return 1
                        sleep 2
                        ipoib_list=`ls $sysfs/class/net | grep ib`
                        for i in $ipoib_list ; do
                                card_if=$2_$i
                                IP=${!card_if}
                                if [ ! -z "$IP" ] ; then
+                                       # print once after "micN"
+                                       [ -z "$once" ] && echo -ne ": "
                                        once=1
-                                       echo -n $i\ 
-                                       mode=`cat $sysfs/class/net/$i/mode`
-                                       $ssh $1 echo $mode \> /sys/class/net/$i/mode
+
                                        $ssh $1 ifconfig $i $IP
+                                       # if fail to bring up IF, log and keep trying others
+                                       if [ $? != 0 ] ; then
+                                               errors+=1
+                                               echo $card_if failed
+                                               continue
+                                       else
+                                               echo -ne "$i "
+                                       fi
+
+                                       mode=`cat $sysfs/class/net/$i/mode` &&
+                                       $ssh $1 echo $mode \> /sys/class/net/$i/mode
                                        errors+=$?
                                fi
                        done
-                       if [ $once -eq 1 ] ; then echo -n -\ ; fi
                fi
        fi