From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1PriTh-0004i9-LG for garchives@archives.gentoo.org; Tue, 22 Feb 2011 02:59:53 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D6E4A1C03E; Tue, 22 Feb 2011 02:59:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 96E061C03E for ; Tue, 22 Feb 2011 02:59:46 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 115A01B415A for ; Tue, 22 Feb 2011 02:59:46 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 74D6E8006E for ; Tue, 22 Feb 2011 02:59:45 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: Subject: [gentoo-commits] proj/openrc:master commit in: net/, doc/ X-VCS-Repository: proj/openrc X-VCS-Files: doc/net.example.Linux.in net/Makefile.Linux net/ethtool.sh X-VCS-Directories: net/ doc/ X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: dfd42d139357b23fb7629bea3bc39918a660cd4c Date: Tue, 22 Feb 2011 02:59:45 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: d781803d43640b0d85643058ce1c2604 commit: dfd42d139357b23fb7629bea3bc39918a660cd4c Author: Robin H. Johnson gentoo org> AuthorDate: Tue Feb 22 02:54:26 2011 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Tue Feb 22 02:59:38 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/openrc.git;a=3D= commit;h=3Ddfd42d13 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 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=3D"--api-mode=3Dwlan" # man ifplugd for more options =20 +#-----------------------------------------------------------------------= ------ +# 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 o= utput +# 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 le= vel to +# notify us of WOL changes, and the SecureOn password to 'DE:AD:BE:EF:CA= :FE'. +#ethtool_change_eth0=3D"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=3D"autoneg off +#rx on tx on" + +# Enasble adaptive RX and TX coalescing +#ethtool_coalesce_eth0=3D"adaptive-rx on adaptive-tx on" + +# Change ring buffer settings +#ethtool_ring_eth0=3D"" + +# Enable all offload settings +#ethtool_offload_eth0=3D"rx on tx on sg on tso on ufo on gso on gro on l= ro on" + +# Change specific bytes in the EEPROM +#ethtool_change_eeprom_eth0=3D"" + +# Run the identify sequence on the interface for 1 second (does not retu= rn until completion) +#ethtool_identify_eth0=3D"1" + +# Configure receive network flow classification +#ethtool_nfc_eth0=3D" +#rx-flow-hash tcp4 f +#rx-flow-hash udp4 s" + +# Flash firmware to all regions +#ethtool_flash_eth0=3D"/some/path/firmware1 0" + +# Flash firmware to region 1 +#ethtool_flash_eth0=3D"/some/path/firmware2 1" + +# Set receive flow hash indirection table for even balancing between N r= eceive queues +#ethtool_rxfh_indir_eth0=3D"equal 4" + +# Configure Rx ntuple filters and actions +#ethtool_ntuple_eth0=3D"" + +# Additionally, there is a special control variable, if you need to chan= ge the +# order of option processing. The default order is: +# flash change-eeprom change pause coalesce ring offload identify nfc rx= fh-indir ntuple + +# Set global order to default +#ethtool_order=3D"flash change-eeprom change pause coalesce ring offload= identify nfc rxfh-indir ntuple" + +# Hypothetical network card that requires a change-eeprom toggle to enab= le flashing +#ethtool_order_eth0=3D"change-eeprom flash change pause coalesce ring of= fload 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+=3D iwconfig.sh.in INC+=3D 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 =20 .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=3D"${OIFS}" + eval order=3D\$ethtool_order_${IFVAR} + [ -z "${order}" ] && eval order=3D\$ethtool_order + [ -z "${order}" ] && order=3D"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=3D\$ethtool_${opt//-/_}_${IFVAR} + + # Skip everything if no arguments + [ -z "${args}" ] && continue + =09 + # Split on \n + local IFS=3D"$__IFS" + + for p in ${args} ; do + IFS=3D"${OIFS}" + local args_pretty=3D"$(_trim "${p}")" + # Do nothing if empty + [ -z "${args_prety}" ] && continue + args_pretty=3D"--${opt} $IFACE ${args_pretty}" + args=3D"--${opt} $IFACE ${args}" + ebegin "ethtool ${args_pretty}" + $(_ethtool) ${args} + rc=3D$? + 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=3D"${OIFS}" + done + eoutdent +}