commit:     4bd8be5f43d07a9e92b73174c7fbef8b989aaa55
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  5 19:54:47 2021 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Apr  5 20:00:28 2021 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=4bd8be5f

net/ethtool: support more ethtool config knobs

Additional options now supported:
--set-channels
--set-dump
--set-fec
--set-phy-tunable
--set-priv-flags
--set-rxfh-indir
--per-queue
--features

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 doc/net.example.Linux.in |  6 +++---
 net/ethtool.sh           | 15 +++++++++++++--
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in
index b2c0f82..e59ce52 100644
--- a/doc/net.example.Linux.in
+++ b/doc/net.example.Linux.in
@@ -1318,10 +1318,10 @@
 # flash change-eeprom change pause eee coalesce ring offload tunable identify 
nfc rxfh-indir ntuple
 
 # Set global order to default
-#ethtool_order="flash change-eeprom change pause eee coalesce ring offload 
tunable identify nfc rxfh-indir ntuple"
+#ethtool_order="flash change-eeprom change priv-flags channels dump pause eee 
fec coalesce per-queue ring offload features phy-tunable tunable 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 eee coalesce ring 
offload tunable nfc rxfh-indir ntuple"
+# Hypothetical network card that requires a change-eeprom or priv-flags toggle 
to enable flashing
+#ethtool_order_eth0="priv-flags change-eeprom flash channels dump pause eee 
fec coalesce per-queue ring offload features phy-tunable tunable identify nfc 
rxfh-indir ntuple"
 
 #-----------------------------------------------------------------------------
 # Firewalld support

diff --git a/net/ethtool.sh b/net/ethtool.sh
index 0bcceff..ee595a2 100644
--- a/net/ethtool.sh
+++ b/net/ethtool.sh
@@ -17,7 +17,7 @@ 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 eee 
coalesce ring offload tunable identify nfc rxfh-indir ntuple"
+       [ -z "${order}" ] && order="flash change-eeprom change priv-flags 
channels dump pause eee fec coalesce per-queue ring offload features 
phy-tunable tunable identify nfc rxfh-indir ntuple"
        # ethtool options not used: --driver, --register-dump, --eeprom-dump, 
--negotiate, --test, --statistics
        eindent
        for opt in ${order} ; do
@@ -36,7 +36,18 @@ ethtool_pre_start() {
                        local args_pretty="$(_trim "${p}")"
                        # Do nothing if empty
                        [ -z "${args_pretty}" ] && continue
-                       [ "${opt}" = "eee" -o "${opt}" = "ring" -o "${opt}" = 
"tunable" ] && opt="set-${opt}"
+                       case "$opt" in
+                               # Cleaner to patch in future for new options
+                               channels) opt="set-${opt}" ;;
+                               dump) opt="set-${opt}" ;;
+                               eee) opt="set-${opt}" ;;
+                               fec) opt="set-${opt}" ;;
+                               phy-tunable) opt="set-${opt}" ;;
+                               priv-flags) opt="set-${opt}" ;;
+                               ring) opt="set-${opt}" ;;
+                               rxfh-indir) opt="set-${opt}" ;;
+                               tunable) opt="set-${opt}" ;;
+                       esac
                        args_pretty="--${opt} $IFACE ${args_pretty}"
                        args="--${opt} $IFACE ${args}"
                        ebegin "ethtool ${args_pretty}"

Reply via email to