2011-02-22 08:24:26 +05:30
|
|
|
# Copyright (c) 2011 by Gentoo Foundation
|
2011-06-30 05:16:31 +05:30
|
|
|
# Released under the 2-clause BSD license.
|
2011-02-22 08:24:26 +05:30
|
|
|
|
|
|
|
ethtool_depend()
|
|
|
|
{
|
2012-01-09 05:54:03 +05:30
|
|
|
program ethtool
|
2011-02-22 08:24:26 +05:30
|
|
|
before interface
|
|
|
|
}
|
|
|
|
|
|
|
|
# This is just to trim whitespace, do not add any quoting!
|
|
|
|
_trim() {
|
|
|
|
echo $*
|
|
|
|
}
|
|
|
|
|
|
|
|
ethtool_pre_start() {
|
|
|
|
local order opt OFS="${OIFS}"
|
|
|
|
eval order=\$ethtool_order_${IFVAR}
|
|
|
|
[ -z "${order}" ] && eval order=\$ethtool_order
|
|
|
|
[ -z "${order}" ] && order="flash change-eeprom change pause coalesce ring offload identify nfc rxfh-indir ntuple"
|
|
|
|
# ethtool options not used: --driver, --register-dump, --eeprom-dump, --negotiate, --test, --statistics
|
|
|
|
eindent
|
|
|
|
for opt in ${order} ; do
|
|
|
|
local args
|
2011-03-28 02:15:45 +05:30
|
|
|
eval args=\$ethtool_$(echo $opt | tr - _)_${IFVAR}
|
2011-02-22 08:24:26 +05:30
|
|
|
|
|
|
|
# Skip everything if no arguments
|
|
|
|
[ -z "${args}" ] && continue
|
2011-07-05 03:57:00 +05:30
|
|
|
|
2011-02-22 08:24:26 +05:30
|
|
|
# Split on \n
|
2011-09-18 18:12:39 +05:30
|
|
|
OIFS="${IFS}"
|
2011-02-22 08:24:26 +05:30
|
|
|
local IFS="$__IFS"
|
|
|
|
|
|
|
|
for p in ${args} ; do
|
|
|
|
IFS="${OIFS}"
|
|
|
|
local args_pretty="$(_trim "${p}")"
|
|
|
|
# Do nothing if empty
|
2011-04-07 18:18:56 +05:30
|
|
|
[ -z "${args_pretty}" ] && continue
|
2011-09-18 18:12:39 +05:30
|
|
|
[ "${opt}" = "ring" ] && opt="set-ring"
|
2011-02-22 08:24:26 +05:30
|
|
|
args_pretty="--${opt} $IFACE ${args_pretty}"
|
|
|
|
args="--${opt} $IFACE ${args}"
|
|
|
|
ebegin "ethtool ${args_pretty}"
|
2012-01-16 23:03:09 +05:30
|
|
|
ethtool ${args}
|
2011-02-22 08:24:26 +05:30
|
|
|
rc=$?
|
|
|
|
eend $rc "ethtool exit code $rc"
|
|
|
|
# TODO: ethtool has MANY different exit codes, with no
|
|
|
|
# documentation as to which ones are fatal or not. For now we
|
|
|
|
# simply print the exit code and don't stop the start sequence.
|
|
|
|
done
|
|
|
|
IFS="${OIFS}"
|
|
|
|
done
|
|
|
|
eoutdent
|
|
|
|
}
|