Commit 151ff499 authored by Adam Wujek's avatar Adam Wujek 💬

Kconfig: add nic throttling configuration

Add startup script /etc/init.d/wrs_throttling.sh for setting up throttling
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 96f442db
......@@ -754,7 +754,22 @@ config WRSAUXCLK_PPSHIFT
should be re-calibrated. Otherwise, 1-PPS output will be shifted
from the WR timescale by <steps>*150ps.
endmenu
menu "NIC throttling configuration"
config NIC_THROTTLING_ENABLED
bool "Enable NIC throttling"
default n
help
Limit bandwith on NIC
config NIC_THROTTLING_VAL
int "NIC throttling value"
depends on NIC_THROTTLING_ENABLED
default "4000"
range 1 65535
help
Value to which bandwith should be limited
endmenu
......
#!/bin/sh
# this script shall be called before enabling the switching
dotconfig=/wr/etc/dot-config
set -o pipefail
start() {
if [ -f $dotconfig ]; then
. $dotconfig
else
echo "$0 unable to start wrs_throttling, unable to source " \
"dot-config ($dotconfig)!"
exit 1
fi
WRS_LOG=$CONFIG_WRS_LOG_OTHER
# if empty turn it to /dev/null
if [ -z $WRS_LOG ]; then
WRS_LOG="/dev/null";
fi
# if a pathname, use it
if echo "$WRS_LOG" | grep / > /dev/null; then
eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \";
else
# not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t wr-switch -p $WRS_LOG\"
fi
echo -n "Starting wrs_throttling: "
if [ "$CONFIG_NIC_THROTTLING_ENABLED" = "y" ] \
&& [ ! -z "$CONFIG_NIC_THROTTLING_VAL" ] ; then
eval /wr/bin/wrs_throttling -t "$CONFIG_NIC_THROTTLING_VAL" $LOGPIPE
ret=$?
if [ $ret -eq 0 ]; then
echo "OK"
else
echo "Failed"
fi
else
echo "throttling disabled"
fi
}
stop() {
echo -n "Stopping wrs_throttling: "
eval /wr/bin/wrs_throttling -d $LOGPIPE
ret=$?
if [ $ret -eq 0 ]; then
echo "OK"
else
echo "Failed"
fi
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
;;
esac
../init.d/wrs_throttling.sh
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment