2 # Intel MIC Platform Software Stack (MPSS)
4 # Copyright(c) 2013 Intel Corporation.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License, version 2, as
8 # published by the Free Software Foundation.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # The full GNU General Public License is included in this distribution in
16 # the file called "COPYING".
18 # Intel MIC User Space Tools.
22 # chkconfig: 2345 95 05
23 # description: start MPSS stack processing.
29 # Short-Description: MPSS stack control
30 # Description: MPSS stack control
33 # Source function library.
34 . /etc/init.d/functions
37 sysfs="/sys/class/mic"
41 [ -x $exec ] || exit 5
43 if [ "`ps -e | awk '{print $4}' | grep mpssd | head -1`" = "mpssd" ]; then
44 echo -e $"MPSSD already running! "
50 echo -e $"Starting MPSS Stack"
51 echo -e $"Loading MIC_HOST Module"
53 # Ensure the driver is loaded
54 if [ ! -d "$sysfs" ]; then
57 if [ $RETVAL -ne 0 ]; then
65 echo -n $"Starting MPSSD "
68 if [ $RETVAL -ne 0 ]; then
81 # Wait till ping works
85 ipaddr=`cat $f/cmdline`
86 ipaddr=${ipaddr#*address,}
87 ipaddr=`echo $ipaddr | cut -d, -f1 | cut -d\; -f1`
88 while [ $count -ge 0 ]
90 echo -e "Pinging "`basename $f`" "
91 ping -c 1 $ipaddr &> /dev/null
93 if [ $RETVAL -eq 0 ]; then
98 count=`expr $count - 1`
100 [ $RETVAL -ne 0 ] && failure || success
108 echo -e $"Shutting down MPSS Stack: "
110 # Bail out if module is unloaded
111 if [ ! -d "$sysfs" ]; then
112 echo -n $"Module unloaded "
118 # Shut down the cards.
121 # Wait for the cards to go offline
124 while [ "`cat $f/state`" != "offline" ]
127 echo -e "Waiting for "`basename $f`" to go offline"
131 # Display the status of the cards
135 echo -n $"Killing MPSSD"
136 killall -9 mpssd 2>/dev/null
138 [ $RETVAL -ne 0 ] && failure || success
153 if [ "`ps -e | awk '{print $4}' | grep mpssd | head -n 1`" = "mpssd" ]; then
154 echo "mpssd is running"
156 echo "mpssd is stopped"
163 if [ ! -d "$sysfs" ]; then
164 echo -n $"No MIC_HOST Module: "
173 echo -n $"Removing MIC_HOST Module: "
176 [ $RETVAL -ne 0 ] && failure || success
198 echo $"Usage: $0 {start|stop|restart|status|unload}"