summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-08-31 12:22:36 +0200
committerChristian Poessinger <christian@poessinger.com>2021-08-31 12:22:36 +0200
commita086dc2c429aea9614ac7a9c735c6475c2d6da59 (patch)
treeb930ebcc7c2bb2676f0bb8522302b0538ffd446b
parent00efce716912680354d47a2dca9769cd8c5c89ae (diff)
downloadvyos-1x-a086dc2c429aea9614ac7a9c735c6475c2d6da59.tar.gz
vyos-1x-a086dc2c429aea9614ac7a9c735c6475c2d6da59.zip
vyos.ethtool: T3163: use long option names when calling the ethtool binray
This makes understanding the code easier what is "really" called without opening the man page.
-rw-r--r--op-mode-definitions/show-interfaces-ethernet.xml.in10
-rw-r--r--python/vyos/ethtool.py2
-rw-r--r--python/vyos/ifconfig/ethernet.py7
3 files changed, 7 insertions, 12 deletions
diff --git a/op-mode-definitions/show-interfaces-ethernet.xml.in b/op-mode-definitions/show-interfaces-ethernet.xml.in
index fc79f44bf..6d50d6e90 100644
--- a/op-mode-definitions/show-interfaces-ethernet.xml.in
+++ b/op-mode-definitions/show-interfaces-ethernet.xml.in
@@ -23,19 +23,19 @@
<properties>
<help>Visually identify specified ethernet interface</help>
</properties>
- <command>echo "Blinking interface $4 for 30 seconds."; /sbin/ethtool --identify "$4" 30</command>
+ <command>echo "Blinking interface $4 for 30 seconds."; ethtool --identify "$4" 30</command>
</leafNode>
<node name="physical">
<properties>
<help>Show physical device information for specified ethernet interface</help>
</properties>
- <command>/sbin/ethtool "$4"; /sbin/ethtool -i "$4"</command>
+ <command>ethtool "$4"; ethtool --driver "$4"</command>
<children>
<leafNode name="offload">
<properties>
<help>Show physical device offloading capabilities</help>
</properties>
- <command>/sbin/ethtool -k "$4" | sed -e 1d -e '/fixed/d' -e 's/^\t*//g' -e 's/://' | column -t -s' '</command>
+ <command>ethtool --show-features "$4" | sed -e 1d -e '/fixed/d' -e 's/^\t*//g' -e 's/://' | column -t -s' '</command>
</leafNode>
</children>
</node>
@@ -43,13 +43,13 @@
<properties>
<help>Show physical device statistics for specified ethernet interface</help>
</properties>
- <command>/sbin/ethtool -S "$4"</command>
+ <command>ethtool --statistics "$4"</command>
</leafNode>
<leafNode name="transceiver">
<properties>
<help>Show transceiver information from modules (e.g SFP+, QSFP)</help>
</properties>
- <command>/sbin/ethtool -m "$4"</command>
+ <command>ethtool --module-info "$4"</command>
</leafNode>
<tagNode name="vif">
<properties>
diff --git a/python/vyos/ethtool.py b/python/vyos/ethtool.py
index 5a5d84bed..7dcb68346 100644
--- a/python/vyos/ethtool.py
+++ b/python/vyos/ethtool.py
@@ -65,7 +65,7 @@ class Ethtool:
self._speed_duplex[speed].update({ duplex : ''})
# Now populate features dictionaty
- out, err = popen(f'ethtool -k {ifname}')
+ out, err = popen(f'ethtool --show-features {ifname}')
# skip the first line, it only says: "Features for eth0":
for line in out.splitlines()[1:]:
if ":" in line:
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py
index 7d29da8fc..76ed3fd92 100644
--- a/python/vyos/ifconfig/ethernet.py
+++ b/python/vyos/ifconfig/ethernet.py
@@ -42,34 +42,29 @@ class EthernetIf(Interface):
@staticmethod
def feature(ifname, option, value):
- run(f'ethtool -K {ifname} {option} {value}')
+ run(f'ethtool --features {ifname} {option} {value}')
return False
_command_set = {**Interface._command_set, **{
'gro': {
'validate': lambda v: assert_list(v, ['on', 'off']),
'possible': lambda i, v: EthernetIf.feature(i, 'gro', v),
- # 'shellcmd': 'ethtool -K {ifname} gro {value}',
},
'gso': {
'validate': lambda v: assert_list(v, ['on', 'off']),
'possible': lambda i, v: EthernetIf.feature(i, 'gso', v),
- # 'shellcmd': 'ethtool -K {ifname} gso {value}',
},
'lro': {
'validate': lambda v: assert_list(v, ['on', 'off']),
'possible': lambda i, v: EthernetIf.feature(i, 'lro', v),
- # 'shellcmd': 'ethtool -K {ifname} lro {value}',
},
'sg': {
'validate': lambda v: assert_list(v, ['on', 'off']),
'possible': lambda i, v: EthernetIf.feature(i, 'sg', v),
- # 'shellcmd': 'ethtool -K {ifname} sg {value}',
},
'tso': {
'validate': lambda v: assert_list(v, ['on', 'off']),
'possible': lambda i, v: EthernetIf.feature(i, 'tso', v),
- # 'shellcmd': 'ethtool -K {ifname} tso {value}',
},
}}