diff options
-rw-r--r-- | ethtool-copy.h | 38 | ||||
-rw-r--r-- | ethtool.c | 85 |
2 files changed, 68 insertions, 55 deletions
diff --git a/ethtool-copy.h b/ethtool-copy.h index 9e26a76..3027ca3 100644 --- a/ethtool-copy.h +++ b/ethtool-copy.h @@ -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 @@ -651,12 +680,17 @@ struct ethtool_flash { * %ETHTOOL_SET_DUMP * @version: FW version of the dump, filled in by driver * @flag: driver dependent flag for dump setting, filled in by driver during - * get and filled in by ethtool for set operation + * get and filled in by ethtool for set operation. + * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when + * firmware dump is disabled. * @len: length of dump data, used as the length of the user buffer on entry to * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver * for %ETHTOOL_GET_DUMP_FLAG command * @data: data collected for get dump data operation */ + +#define ETH_FW_DUMP_DISABLE 0 + struct ethtool_dump { __u32 cmd; __u32 version; @@ -848,6 +882,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 @@ -444,8 +444,25 @@ static void dump_supported(struct ethtool_cmd *ep) static void dump_link_caps(const char *prefix, const char *an_prefix, u32 mask) { + static const struct { + int same_line; /* print on same line as previous */ + u32 value; + const char *name; + } mode_defs[] = { + { 0, ADVERTISED_10baseT_Half, "10baseT/Half" }, + { 1, ADVERTISED_10baseT_Full, "10baseT/Full" }, + { 0, ADVERTISED_100baseT_Half, "100baseT/Half" }, + { 1, ADVERTISED_100baseT_Full, "100baseT/Full" }, + { 0, ADVERTISED_1000baseT_Half, "1000baseT/Half" }, + { 1, ADVERTISED_1000baseT_Full, "1000baseT/Full" }, + { 0, ADVERTISED_1000baseKX_Full, "1000baseKX/Full" }, + { 0, ADVERTISED_2500baseX_Full, "2500baseX/Full" }, + { 0, ADVERTISED_10000baseT_Full, "10000baseT/Full" }, + { 0, ADVERTISED_10000baseKX4_Full, "10000baseKX4/Full" }, + { 0, ADVERTISED_20000baseMLD2_Full, "20000baseMLD2/Full" }, + }; int indent; - int did1; + int did1, new_line_pend, i; /* Indent just like the separate functions used to */ indent = strlen(prefix) + 14; @@ -455,59 +472,19 @@ dump_link_caps(const char *prefix, const char *an_prefix, u32 mask) fprintf(stdout, " %s link modes:%*s", prefix, indent - (int)strlen(prefix) - 12, ""); did1 = 0; - if (mask & ADVERTISED_10baseT_Half) { - did1++; fprintf(stdout, "10baseT/Half "); - } - if (mask & ADVERTISED_10baseT_Full) { - did1++; fprintf(stdout, "10baseT/Full "); - } - if (did1 && (mask & (ADVERTISED_100baseT_Half|ADVERTISED_100baseT_Full))) { - fprintf(stdout, "\n"); - fprintf(stdout, " %*s", indent, ""); - } - if (mask & ADVERTISED_100baseT_Half) { - did1++; fprintf(stdout, "100baseT/Half "); - } - if (mask & ADVERTISED_100baseT_Full) { - did1++; fprintf(stdout, "100baseT/Full "); - } - if (did1 && (mask & (ADVERTISED_1000baseT_Half|ADVERTISED_1000baseT_Full))) { - fprintf(stdout, "\n"); - fprintf(stdout, " %*s", indent, ""); - } - if (mask & ADVERTISED_1000baseT_Half) { - did1++; fprintf(stdout, "1000baseT/Half "); - } - if (mask & ADVERTISED_1000baseT_Full) { - did1++; fprintf(stdout, "1000baseT/Full "); - } - if (did1 && (mask & ADVERTISED_2500baseX_Full)) { - fprintf(stdout, "\n"); - fprintf(stdout, " %*s", indent, ""); - } - if (mask & ADVERTISED_2500baseX_Full) { - did1++; fprintf(stdout, "2500baseX/Full "); - } - if (did1 && (mask & ADVERTISED_10000baseT_Full)) { - fprintf(stdout, "\n"); - fprintf(stdout, " %*s", indent, ""); - } - if (mask & ADVERTISED_10000baseT_Full) { - did1++; fprintf(stdout, "10000baseT/Full "); - } - if (did1 && (mask & ADVERTISED_20000baseMLD2_Full)) { - fprintf(stdout, "\n"); - fprintf(stdout, " %*s", indent, ""); - } - if (mask & ADVERTISED_20000baseMLD2_Full) { - did1++; fprintf(stdout, "20000baseMLD2/Full "); - } - if (did1 && (mask & ADVERTISED_20000baseKR2_Full)) { - fprintf(stdout, "\n"); - fprintf(stdout, " %*s", indent, ""); - } - if (mask & ADVERTISED_20000baseKR2_Full) { - did1++; fprintf(stdout, "20000baseKR2/Full "); + new_line_pend = 0; + for (i = 0; i < ARRAY_SIZE(mode_defs); i++) { + if (did1 && !mode_defs[i].same_line) + new_line_pend = 1; + if (mask & mode_defs[i].value) { + if (new_line_pend) { + fprintf(stdout, "\n"); + fprintf(stdout, " %*s", indent, ""); + new_line_pend = 0; + } + did1++; + fprintf(stdout, "%s ", mode_defs[i].name); + } } if (did1 == 0) fprintf(stdout, "Not reported"); |