From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/openrc:master commit in: net/, doc/
Date: Tue, 22 Feb 2011 02:59:45 +0000 (UTC) [thread overview]
Message-ID: <dfd42d139357b23fb7629bea3bc39918a660cd4c.robbat2@gentoo> (raw)
commit: dfd42d139357b23fb7629bea3bc39918a660cd4c
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 22 02:54:26 2011 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Tue Feb 22 02:59:38 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=dfd42d13
net/ethtool: official interface for changing ethtool params (bug #195479)
Implement a consistent interface for changing ethtool parameters, as
suggested in bug 195479. All variable names are based on the long option
to ethtool to set each group of parameters. Multiple entries seperated
by newlines are permitted for variable values.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
X-Gentoo-Bug: 195479
---
doc/net.example.Linux.in | 66 ++++++++++++++++++++++++++++++++++++++++++++++
net/Makefile.Linux | 4 +-
net/ethtool.sh | 54 +++++++++++++++++++++++++++++++++++++
3 files changed, 122 insertions(+), 2 deletions(-)
diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in
index d3b97c5..69c9ba6 100644
--- a/doc/net.example.Linux.in
+++ b/doc/net.example.Linux.in
@@ -980,6 +980,72 @@
#ifplugd_eth0="--api-mode=wlan"
# man ifplugd for more options
+#-----------------------------------------------------------------------------
+# Interface hardware tuning & configuration via ethtool
+# If you need to change explicit hardware settings on your network card prior
+# to bringing the interface up, the following is available.
+#
+# For a full listing of settings, please consulting ethtool(8) and the output
+# of "ethtool --help".
+#
+# Multiple entries (seperated by newlines) are supported in all of the
+# variables as some settings cannot be changed at the same time.
+#
+# Valid variable name fragments: change pause coalesce ring offload
+# change_eeprom identify nfc flash rxfh_indir ntuple
+
+# Set Wake-On-Lan to listen for SecureOn MagicPacket(tm), the message level to
+# notify us of WOL changes, and the SecureOn password to 'DE:AD:BE:EF:CA:FE'.
+#ethtool_change_eth0="wol gs
+#msglvl wol on
+#sopass DE:AD:BE:EF:CA:FE"
+
+# Disable pause auto-negotiation and explicitly enable RX and TX pause.
+#ethtool_pause_eth0="autoneg off
+#rx on tx on"
+
+# Enasble adaptive RX and TX coalescing
+#ethtool_coalesce_eth0="adaptive-rx on adaptive-tx on"
+
+# Change ring buffer settings
+#ethtool_ring_eth0=""
+
+# Enable all offload settings
+#ethtool_offload_eth0="rx on tx on sg on tso on ufo on gso on gro on lro on"
+
+# Change specific bytes in the EEPROM
+#ethtool_change_eeprom_eth0=""
+
+# Run the identify sequence on the interface for 1 second (does not return until completion)
+#ethtool_identify_eth0="1"
+
+# Configure receive network flow classification
+#ethtool_nfc_eth0="
+#rx-flow-hash tcp4 f
+#rx-flow-hash udp4 s"
+
+# Flash firmware to all regions
+#ethtool_flash_eth0="/some/path/firmware1 0"
+
+# Flash firmware to region 1
+#ethtool_flash_eth0="/some/path/firmware2 1"
+
+# Set receive flow hash indirection table for even balancing between N receive queues
+#ethtool_rxfh_indir_eth0="equal 4"
+
+# Configure Rx ntuple filters and actions
+#ethtool_ntuple_eth0=""
+
+# Additionally, there is a special control variable, if you need to change the
+# order of option processing. The default order is:
+# flash change-eeprom change pause coalesce ring offload identify nfc rxfh-indir ntuple
+
+# Set global order to default
+#ethtool_order="flash change-eeprom change pause coalesce ring offload identify nfc rxfh-indir ntuple"
+
+# Hypothetical network card that requires a change-eeprom toggle to enable flashing
+#ethtool_order_eth0="change-eeprom flash change pause coalesce ring offload nfc rxfh-indir ntuple"
+
##############################################################################
# ADVANCED CONFIGURATION
#
diff --git a/net/Makefile.Linux b/net/Makefile.Linux
index 7006d74..f7fb087 100644
--- a/net/Makefile.Linux
+++ b/net/Makefile.Linux
@@ -1,7 +1,7 @@
SRCS+= iwconfig.sh.in
INC+= adsl.sh apipa.sh arping.sh bonding.sh br2684ctl.sh bridge.sh \
- ccwgroup.sh clip.sh iproute2.sh ifplugd.sh ip6to4.sh ipppd.sh \
- iwconfig.sh netplugd.sh pppd.sh pump.sh tuntap.sh udhcpc.sh \
+ ccwgroup.sh clip.sh ethtool.sh iproute2.sh ifplugd.sh ip6to4.sh \
+ ipppd.sh iwconfig.sh netplugd.sh pppd.sh pump.sh tuntap.sh udhcpc.sh \
vlan.sh
.SUFFIXES: .sh.Linux.in
diff --git a/net/ethtool.sh b/net/ethtool.sh
new file mode 100644
index 0000000..64b44a6
--- /dev/null
+++ b/net/ethtool.sh
@@ -0,0 +1,54 @@
+# Copyright (c) 2011 by Gentoo Foundation
+# All rights reserved. Released under the 2-clause BSD license.
+
+_ethtool() {
+ echo /usr/sbin/ethtool
+}
+
+ethtool_depend()
+{
+ program $(_ethtool)
+ 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
+ eval args=\$ethtool_${opt//-/_}_${IFVAR}
+
+ # Skip everything if no arguments
+ [ -z "${args}" ] && continue
+
+ # Split on \n
+ local IFS="$__IFS"
+
+ for p in ${args} ; do
+ IFS="${OIFS}"
+ local args_pretty="$(_trim "${p}")"
+ # Do nothing if empty
+ [ -z "${args_prety}" ] && continue
+ args_pretty="--${opt} $IFACE ${args_pretty}"
+ args="--${opt} $IFACE ${args}"
+ ebegin "ethtool ${args_pretty}"
+ $(_ethtool) ${args}
+ 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
+}
next reply other threads:[~2011-02-22 2:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 2:59 Robin H. Johnson [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-11-05 23:22 [gentoo-commits] proj/openrc:master commit in: net/, doc/ William Hubbs
2012-07-20 17:20 Robin H. Johnson
2011-12-13 8:21 Robin H. Johnson
2011-12-13 4:12 William Hubbs
2011-10-26 16:31 William Hubbs
2011-04-19 17:49 Robin H. Johnson
2011-04-19 17:19 Robin H. Johnson
2011-02-21 9:44 Robin H. Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dfd42d139357b23fb7629bea3bc39918a660cd4c.robbat2@gentoo \
--to=robbat2@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox