Ethtool: Add EEE support
Subsystems (2)
PATCH v2 1/1 Ethtool: Add EEE support
This patch adds 2 new ethtool commands which can be used to manipulate network interfaces' support in EEE.
Output of 'get' has the following form:
EEE Settings for p2p1:
EEE status: enabled - active
Tx LPI: 1000 (us)
Supported EEE link modes: 10000baseT/Full Advertised EEE link modes: 10000baseT/Full Link partner advertised EEE link modes: 10000baseT/Full
Thanks goes to Giuseppe Cavallaro for his original patch.
--- ethtool-copy.h | 31 +++++++++++++ ethtool.8.in | 32 +++++++++++++ ethtool.c | 137 +++++++++++++++++++++++++++++++++++++++++++++++-------- test-cmdline.c | 11 +++++ 4 files changed, 191 insertions(+), 20 deletions(-)
ethtool-copy.h +31 -0
@@ -134,6 +134,35 @@ struct ethtool_eeprom { };/** +* struct ethtool_eee - Energy Efficient Ethernet information +* @cmd: ETHTOOL_{G,S}EEE +* @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations +* for which there is EEE support. +* @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations +* advertised as eee capable. +* @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex +* combinations advertised by the link partner as eee capable. +* @eee_active: Result of the eee auto negotiation. +* @eee_enabled: EEE configured mode (enabled/disabled). +* @tx_lpi_enabled: Whether the interface should assert its tx lpi, given +* that eee was negotiated. +* @tx_lpi_timer: Time in microseconds the interface delays prior to asserting +* its tx lpi (after reaching 'idle' state). Effective only when eee +* was negotiated and tx_lpi_enabled was set. +*/ +struct ethtool_eee { +__u32 cmd; +__u32 supported; +__u32 advertised; +__u32 lp_advertised; +__u32 eee_active; +__u32 eee_enabled; +__u32 tx_lpi_enabled; +__u32 tx_lpi_timer; +__u32 reserved[2 ]; +}; + +/** * struct ethtool_modinfo - plugin module eeprom information * @cmd: %ETHTOOL_GMODULEINFO * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx
@@ -848,6 +877,8 @@ enum ethtool_sfeatures_retval_bits {#define ETHTOOL_GET_TS_INFO 0x00000041/* Get time stamping and PHC info */ #define ETHTOOL_GMODULEINFO 0x00000042/* Get plug-in module information */ #define ETHTOOL_GMODULEEEPROM 0x00000043/* Get plug-in module eeprom */ +#define ETHTOOL_GEEE 0x00000044/* Get EEE settings */ +#define ETHTOOL_SEEE 0x00000045/* Set EEE settings */ /* compatibility with older code */ #define SPARC_ETH_GSET ETHTOOL_GSET
ethtool.8.in +32 -0
@@ -335,6 +335,16 @@ ethtool \- query or control network driver and hardware settings .I devname flag .A1 on off .RB ... +.HP +.B ethtool \-\-get\-eee +.I devname +.HP +.B ethtool \-\-set\-eee +.I devname +.B2 eee on off +.B2 tx-lpi on off +.BN tx-timer +.BN advertise . .\" Adjust lines (i.e. full justification) and hyphenate. .ad
@@ -817,6 +827,28 @@ Sets the device's private flags as specified. .I flag .A1 on off Sets the state of the named private flag. +.TP +.B \-\-get\-eee +Queries the specified network device for its support in Efficient Energy +Ethernet (according to the IEEE 802.3az specifications) +.TP +.B \-\-set\-eee +Sets the device EEE behaviour. +.TP +.A2 eee on off +Enables/Disables the device support in EEE. +.TP +.A2 tx-lpi on off +Determines whether the device should assert its tx lpi. +.TP +.BI advertise \ N +Sets the speeds for which the device would advertise EEE capabliities. +Values are as for +.B \-\-change advertise +.TP +.BI tx-timer \ N +Sets the amount of time the device should stay in idle mode prior to asserting +its tx lpi (in microseconds). This has meaning only when tx lpi is on. .SH BUGS Not supported (in part or whole) on all network drivers. .SH AUTHOR
ethtool.c +117 -20
190 lines not on this page · raw message
test-cmdline.c +11 -0
@@ -223,6 +223,17 @@ static struct test_case { { 0, "-m devname hex off" }, { 1, "-m devname hex on raw on" }, { 0, "-m devname offset 4 length 6" }, + { 1, "--get-eee" }, + { 0, "--get-eee devname" }, + { 0, "--get-eee devname foo" }, + { 1, "--set-eee" }, + { 1, "--set-eee devname" }, + { 0, "--set-eee devname eee on" }, + { 0, "--set-eee devname eee off" }, + { 0, "--set-eee devname tx-lpi on" }, + { 0, "--set-eee devname tx-lpi off" }, + { 1, "--set-eee devname tx-timer foo" }, + { 1, "--set-eee devname advertise foo" },/* can't test --set-priv-flags yet */ { 0, "-h" }, { 0, "--help" },
Signature · 1 line
1.7.9.rc2
Quoted 6 lines · Yuval Mintz
This patch adds 2 new ethtool commands which can be used to manipulate network interfaces' support in EEE.
Output of 'get' has the following form:
Quoted 8 lines
EEE Settings for p2p1:
EEE status: enabled - active
Tx LPI: 1000 (us)
Supported EEE link modes: 10000baseT/Full Advertised EEE link modes: 10000baseT/Full Link partner advertised EEE link modes: 10000baseT/FullThanks goes to Giuseppe Cavallaro for his original patch.
[...]
You're supposed to actually run the self-tests (make check):
make[1]: Entering directory `/home/bwh/src/ethtool'
E: ethtool --get-eee devname foo returns 1
FAIL: test-cmdline
Ben.
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Quoted 3 lines · Yuval Mintz
This patch adds 2 new ethtool commands which can be used to manipulate network interfaces' support in EEE.
[...]
ethtool.c static const struct option { · line 3522
Quoted 10 lines
ethtool.c +6
-0@@ -3423,6 +3514,12 @@ static const struct option {" [ hex on|off ]\n" " [ offset N ]\n" " [ length N ]\n" }, + { "--get-eee", 1, do_geee, "Get EEE settings"}, + { "--set-eee", 1, do_seee, "Set EEE settings", +" [ eee on|off ]\n" +" [ advertise %x ]\n" +" [ tx-lpi on|off ]\n" + " [ tx-timer %d ]\n"},
[...]
Another thing: the long options are generally --foo to set/change foo settings and --show-foo to get/show foo settings. Please rename these options to match.
Ben.
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Quoted 17 lines · Ben Hutchings
Quoted 3 lines · Yuval Mintz
This patch adds 2 new ethtool commands which can be used to manipulate network interfaces' support in EEE.
[...]
Quoted 10 lines
ethtool.c +6
-0@@ -3423,6 +3514,12 @@ static const struct option {" [ hex on|off ]\n" " [ offset N ]\n" " [ length N ]\n" }, + { "--get-eee", 1, do_geee, "Get EEE settings"}, + { "--set-eee", 1, do_seee, "Set EEE settings", +" [ eee on|off ]\n" +" [ advertise %x ]\n" +" [ tx-lpi on|off ]\n" + " [ tx-timer %d ]\n"},[...]
Quoted 3 lines
Another thing: the long options are generally --foo to set/change foo settings and --show-foo to get/show foo settings. Please rename these options to match.
Hmm, we already have a lot of --set-foo options, so never mind that. But do change --get-eee to --show-eee.
Ben.
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.