From 4cc9fbfadd54e69ecda34d3238af49f21c063b1f Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 10 2018 05:36:27 +0000 Subject: import ethtool-4.8-7.el7 --- diff --git a/SOURCES/0004-ethtool-Fix-SFF-8079-cable-technology-bit-parsing.patch b/SOURCES/0004-ethtool-Fix-SFF-8079-cable-technology-bit-parsing.patch new file mode 100644 index 0000000..9c67185 --- /dev/null +++ b/SOURCES/0004-ethtool-Fix-SFF-8079-cable-technology-bit-parsing.patch @@ -0,0 +1,36 @@ +From 51f9fba287ff7c8b10e0d5291cd66e78d40b6b8f Mon Sep 17 00:00:00 2001 +From: Gal Pressman +Date: Sun, 19 Mar 2017 14:10:41 +0200 +Subject: [PATCH 4/7] ethtool: Fix SFF 8079 cable technology bit parsing + +According to the transceiver compliance code definition in the spec, bits +2 & 3 in the 8th byte are indication of active/passive cable, and not +specifically related to FC/copper. + +Fixes: 2edf56749abe ("ethtool: Addition of -m option to dump module eeprom") +Signed-off-by: Gal Pressman +Signed-off-by: John W. Linville +(cherry picked from commit e33c8841f26090031d571fddd71dab06f56ab1bf) +--- + sfpid.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sfpid.c b/sfpid.c +index fd6415c..1732e5e 100644 +--- a/sfpid.c ++++ b/sfpid.c +@@ -137,9 +137,9 @@ static void sff8079_show_transceiver(const __u8 *id) + if (id[8] & (1 << 4)) + printf("%s FC: Longwave laser (LL)\n", pfx); + if (id[8] & (1 << 3)) +- printf("%s FC: Copper Active\n", pfx); ++ printf("%s Active Cable\n", pfx); + if (id[8] & (1 << 2)) +- printf("%s FC: Copper Passive\n", pfx); ++ printf("%s Passive Cable\n", pfx); + if (id[8] & (1 << 1)) + printf("%s FC: Copper FC-BaseT\n", pfx); + /* Fibre Channel transmission media */ +-- +1.8.3.1 + diff --git a/SOURCES/0005-ethtool-Support-for-configurable-RSS-hash-function.patch b/SOURCES/0005-ethtool-Support-for-configurable-RSS-hash-function.patch new file mode 100644 index 0000000..7020ab2 --- /dev/null +++ b/SOURCES/0005-ethtool-Support-for-configurable-RSS-hash-function.patch @@ -0,0 +1,188 @@ +From e89f3c656ff17741aa3ea33c57bc177afedc999b Mon Sep 17 00:00:00 2001 +From: Gal Pressman +Date: Wed, 8 Mar 2017 16:03:51 +0200 +Subject: [PATCH 5/7] ethtool: Support for configurable RSS hash function + +This ethtool patch adds support to set and get the current RSS hash +function for the device through the new hfunc mask field in the +ethtool_rxfh struct. Kernel supported hash function names are queried +with ETHTOOL_GSTRINGS - each string is corresponding with a bit in hfunc +mask according to its index in the string-set. + +(This corrects the mistaken revert from commit 126464e4da182064. -- JWL) + +Signed-off-by: Eyal Perry +Signed-off-by: Gal Pressman +Reviewed-by: Saeed Mahameed +Signed-off-by: John W. Linville +(cherry picked from commit b888f358763a20625a381e071ea50524a520c7c1) +--- + ethtool.8.in | 6 ++++++ + ethtool.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- + 2 files changed, 69 insertions(+), 3 deletions(-) + +diff --git a/ethtool.8.in b/ethtool.8.in +index 9631847..b69c5c6 100644 +--- a/ethtool.8.in ++++ b/ethtool.8.in +@@ -301,6 +301,8 @@ ethtool \- query or control network driver and hardware settings + .BI weight\ W0 + .IR W1 + .RB ...\ | \ default \ ] ++.RB [ hfunc ++.IR FUNC ] + .HP + .B ethtool \-f|\-\-flash + .I devname file +@@ -853,6 +855,10 @@ Sets RSS hash key of the specified network device. RSS hash key should be of dev + Hash key format must be in xx:yy:zz:aa:bb:cc format meaning both the nibbles of a byte should be mentioned + even if a nibble is zero. + .TP ++.BI hfunc ++Sets RSS hash function of the specified network device. ++List of RSS hash functions which kernel supports is shown as a part of the --show-rxfh command output. ++.TP + .BI equal\ N + Sets the receive flow hash indirection table to spread flows evenly + between the first \fIN\fR receive queues. +diff --git a/ethtool.c b/ethtool.c +index ce48639..8eba6e6 100644 +--- a/ethtool.c ++++ b/ethtool.c +@@ -3640,6 +3640,7 @@ static int do_grxfhindir(struct cmd_context *ctx, + + static int do_grxfh(struct cmd_context *ctx) + { ++ struct ethtool_gstrings *hfuncs = NULL; + struct ethtool_rxfh rss_head = {0}; + struct ethtool_rxnfc ring_count; + struct ethtool_rxfh *rss; +@@ -3697,6 +3698,26 @@ static int do_grxfh(struct cmd_context *ctx) + printf("%02x:", (u8) hkey[i]); + } + ++ printf("RSS hash function:\n"); ++ if (!rss->hfunc) { ++ printf(" Operation not supported\n"); ++ goto out; ++ } ++ ++ hfuncs = get_stringset(ctx, ETH_SS_RSS_HASH_FUNCS, 0, 1); ++ if (!hfuncs) { ++ perror("Cannot get hash functions names"); ++ free(rss); ++ return 1; ++ } ++ ++ for (i = 0; i < hfuncs->len; i++) ++ printf(" %s: %s\n", ++ (const char *)hfuncs->data + i * ETH_GSTRING_LEN, ++ (rss->hfunc & (1 << i)) ? "on" : "off"); ++ ++out: ++ free(hfuncs); + free(rss); + return 0; + } +@@ -3800,11 +3821,16 @@ static int do_srxfh(struct cmd_context *ctx) + struct ethtool_rxfh *rss; + struct ethtool_rxnfc ring_count; + int rxfhindir_equal = 0, rxfhindir_default = 0; ++ struct ethtool_gstrings *hfuncs = NULL; + char **rxfhindir_weight = NULL; + char *rxfhindir_key = NULL; ++ char *req_hfunc_name = NULL; ++ char *hfunc_name = NULL; + char *hkey = NULL; + int err = 0; ++ int i; + u32 arg_num = 0, indir_bytes = 0; ++ u32 req_hfunc = 0; + u32 entry_size = sizeof(rss_head.rss_config[0]); + u32 num_weights = 0; + +@@ -3836,6 +3862,12 @@ static int do_srxfh(struct cmd_context *ctx) + } else if (!strcmp(ctx->argp[arg_num], "default")) { + ++arg_num; + rxfhindir_default = 1; ++ } else if (!strcmp(ctx->argp[arg_num], "hfunc")) { ++ ++arg_num; ++ req_hfunc_name = ctx->argp[arg_num]; ++ if (!req_hfunc_name) ++ exit_bad_args(); ++ ++arg_num; + } else { + exit_bad_args(); + } +@@ -3868,7 +3900,8 @@ static int do_srxfh(struct cmd_context *ctx) + + rss_head.cmd = ETHTOOL_GRSSH; + err = send_ioctl(ctx, &rss_head); +- if (err < 0 && errno == EOPNOTSUPP && !rxfhindir_key) { ++ if (err < 0 && errno == EOPNOTSUPP && !rxfhindir_key && ++ !req_hfunc_name) { + return do_srxfhindir(ctx, rxfhindir_default, rxfhindir_equal, + rxfhindir_weight, num_weights); + } else if (err < 0) { +@@ -3886,14 +3919,39 @@ static int do_srxfh(struct cmd_context *ctx) + if (rxfhindir_equal || rxfhindir_weight) + indir_bytes = rss_head.indir_size * entry_size; + ++ if (rss_head.hfunc && req_hfunc_name) { ++ hfuncs = get_stringset(ctx, ETH_SS_RSS_HASH_FUNCS, 0, 1); ++ if (!hfuncs) { ++ perror("Cannot get hash functions names"); ++ return 1; ++ } ++ ++ for (i = 0; i < hfuncs->len && !req_hfunc ; i++) { ++ hfunc_name = (char *)(hfuncs->data + ++ i * ETH_GSTRING_LEN); ++ if (!strncmp(hfunc_name, req_hfunc_name, ++ ETH_GSTRING_LEN)) ++ req_hfunc = (u32)1 << i; ++ } ++ ++ if (!req_hfunc) { ++ fprintf(stderr, ++ "Unknown hash function: %s\n", req_hfunc_name); ++ free(hfuncs); ++ return 1; ++ } ++ } ++ + rss = calloc(1, sizeof(*rss) + indir_bytes + rss_head.key_size); + if (!rss) { + perror("Cannot allocate memory for RX flow hash config"); +- return 1; ++ err = 1; ++ goto free; + } + rss->cmd = ETHTOOL_SRSSH; + rss->indir_size = rss_head.indir_size; + rss->key_size = rss_head.key_size; ++ rss->hfunc = req_hfunc; + + if (fill_indir_table(&rss->indir_size, rss->rss_config, rxfhindir_default, + rxfhindir_equal, rxfhindir_weight, num_weights)) { +@@ -3918,6 +3976,7 @@ free: + free(hkey); + + free(rss); ++ free(hfuncs); + return err; + } + +@@ -4650,7 +4709,8 @@ static const struct option { + { "-X|--set-rxfh-indir|--rxfh", 1, do_srxfh, + "Set Rx flow hash indirection table and/or RSS hash key", + " [ equal N | weight W0 W1 ... | default ]\n" +- " [ hkey %x:%x:%x:%x:%x:.... ]\n" }, ++ " [ hkey %x:%x:%x:%x:%x:.... ]\n" ++ " [ hfunc FUNC ]\n" }, + { "-f|--flash", 1, do_flash, + "Flash firmware image from the specified file to a region on the device", + " FILENAME [ REGION-NUMBER-TO-FLASH ]\n" }, +-- +1.8.3.1 + diff --git a/SOURCES/0006-net_tstamp.h-sync-with-net-next.patch b/SOURCES/0006-net_tstamp.h-sync-with-net-next.patch new file mode 100644 index 0000000..8a3f21d --- /dev/null +++ b/SOURCES/0006-net_tstamp.h-sync-with-net-next.patch @@ -0,0 +1,129 @@ +From 13e8c7b8c8537488bc7612c11c429cec274db1f9 Mon Sep 17 00:00:00 2001 +From: Miroslav Lichvar +Date: Tue, 23 May 2017 16:29:29 +0200 +Subject: [PATCH 6/7] net_tstamp.h: sync with net-next + +This covers kernel changes up to: + +commit b50a5c70ffa4fd6b6da324ab54c84adf48fb17d9 +Author: Miroslav Lichvar +Date: Fri May 19 17:52:40 2017 +0200 + + net: allow simultaneous SW and HW transmit timestamping + + Add SOF_TIMESTAMPING_OPT_TX_SWHW option to allow an outgoing packet to + be looped to the socket's error queue with a software timestamp even + when a hardware transmit timestamp is expected to be provided by the + driver. + + Applications using this option will receive two separate messages from + the error queue, one with a software timestamp and the other with a + hardware timestamp. As the hardware timestamp is saved to the shared skb + info, which may happen before the first message with software timestamp + is received by the application, the hardware timestamp is copied to the + SCM_TIMESTAMPING control message only when the skb has no software + timestamp or it is an incoming packet. + + While changing sw_tx_timestamp(), inline it in skb_tx_timestamp() as + there are no other users. + + CC: Richard Cochran + CC: Willem de Bruijn + Signed-off-by: Miroslav Lichvar + Acked-by: Willem de Bruijn + Signed-off-by: David S. Miller + +CC: Richard Cochran +Signed-off-by: Miroslav Lichvar +Signed-off-by: John W. Linville +(cherry picked from commit ba800e3b4acd0692fc16013acbab2c3ac1ecfe66) +--- + net_tstamp-copy.h | 52 +++++++++++++++++++++++++++++++++++++++++----------- + 1 file changed, 41 insertions(+), 11 deletions(-) + +diff --git a/net_tstamp-copy.h b/net_tstamp-copy.h +index ae5df12..3d421d9 100644 +--- a/net_tstamp-copy.h ++++ b/net_tstamp-copy.h +@@ -9,6 +9,7 @@ + #ifndef _NET_TIMESTAMPING_H + #define _NET_TIMESTAMPING_H + ++#include + #include /* for SO_TIMESTAMPING */ + + /* SO_TIMESTAMPING gets an integer bit field comprised of these values */ +@@ -20,23 +21,42 @@ enum { + SOF_TIMESTAMPING_SOFTWARE = (1<<4), + SOF_TIMESTAMPING_SYS_HARDWARE = (1<<5), + SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6), +- SOF_TIMESTAMPING_MASK = +- (SOF_TIMESTAMPING_RAW_HARDWARE - 1) | +- SOF_TIMESTAMPING_RAW_HARDWARE ++ SOF_TIMESTAMPING_OPT_ID = (1<<7), ++ SOF_TIMESTAMPING_TX_SCHED = (1<<8), ++ SOF_TIMESTAMPING_TX_ACK = (1<<9), ++ SOF_TIMESTAMPING_OPT_CMSG = (1<<10), ++ SOF_TIMESTAMPING_OPT_TSONLY = (1<<11), ++ SOF_TIMESTAMPING_OPT_STATS = (1<<12), ++ SOF_TIMESTAMPING_OPT_PKTINFO = (1<<13), ++ SOF_TIMESTAMPING_OPT_TX_SWHW = (1<<14), ++ ++ SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_OPT_TX_SWHW, ++ SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) | ++ SOF_TIMESTAMPING_LAST + }; + ++/* ++ * SO_TIMESTAMPING flags are either for recording a packet timestamp or for ++ * reporting the timestamp to user space. ++ * Recording flags can be set both via socket options and control messages. ++ */ ++#define SOF_TIMESTAMPING_TX_RECORD_MASK (SOF_TIMESTAMPING_TX_HARDWARE | \ ++ SOF_TIMESTAMPING_TX_SOFTWARE | \ ++ SOF_TIMESTAMPING_TX_SCHED | \ ++ SOF_TIMESTAMPING_TX_ACK) ++ + /** +- * struct hwtstamp_config - %SIOCSHWTSTAMP parameter ++ * struct hwtstamp_config - %SIOCGHWTSTAMP and %SIOCSHWTSTAMP parameter + * +- * @flags: no flags defined right now, must be zero ++ * @flags: no flags defined right now, must be zero for %SIOCSHWTSTAMP + * @tx_type: one of HWTSTAMP_TX_* +- * @rx_type: one of one of HWTSTAMP_FILTER_* ++ * @rx_filter: one of HWTSTAMP_FILTER_* + * +- * %SIOCSHWTSTAMP expects a &struct ifreq with a ifr_data pointer to +- * this structure. dev_ifsioc() in the kernel takes care of the +- * translation between 32 bit userspace and 64 bit kernel. The +- * structure is intentionally chosen so that it has the same layout on +- * 32 and 64 bit systems, don't break this! ++ * %SIOCGHWTSTAMP and %SIOCSHWTSTAMP expect a &struct ifreq with a ++ * ifr_data pointer to this structure. For %SIOCSHWTSTAMP, if the ++ * driver or hardware does not support the requested @rx_filter value, ++ * the driver may use a more general filter mode. In this case ++ * @rx_filter will indicate the actual mode on return. + */ + struct hwtstamp_config { + int flags; +@@ -108,6 +128,16 @@ enum hwtstamp_rx_filters { + HWTSTAMP_FILTER_PTP_V2_SYNC, + /* PTP v2/802.AS1, any layer, Delay_req packet */ + HWTSTAMP_FILTER_PTP_V2_DELAY_REQ, ++ ++ /* NTP, UDP, all versions and packet modes */ ++ HWTSTAMP_FILTER_NTP_ALL, ++}; ++ ++/* SCM_TIMESTAMPING_PKTINFO control message */ ++struct scm_ts_pktinfo { ++ __u32 if_index; ++ __u32 pkt_length; ++ __u32 reserved[2]; + }; + + #endif /* _NET_TIMESTAMPING_H */ +-- +1.8.3.1 + diff --git a/SOURCES/0007-ethtool-add-support-for-HWTSTAMP_FILTER_NTP_ALL.patch b/SOURCES/0007-ethtool-add-support-for-HWTSTAMP_FILTER_NTP_ALL.patch new file mode 100644 index 0000000..3bb7ff3 --- /dev/null +++ b/SOURCES/0007-ethtool-add-support-for-HWTSTAMP_FILTER_NTP_ALL.patch @@ -0,0 +1,40 @@ +From ee10917f5cb60f8602deac815ec9923258fa6ab2 Mon Sep 17 00:00:00 2001 +From: Miroslav Lichvar +Date: Tue, 23 May 2017 16:29:30 +0200 +Subject: [PATCH 7/7] ethtool: add support for HWTSTAMP_FILTER_NTP_ALL + +Add HWTSTAMP_FILTER_NTP_ALL to the list of hardware receive +filters which can be printed by ethtool -T. + +CC: Richard Cochran +Signed-off-by: Miroslav Lichvar +Signed-off-by: John W. Linville +(cherry picked from commit d976d5dada4e58d3fdc31506943307159289493a) +--- + ethtool.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/ethtool.c b/ethtool.c +index 8eba6e6..5465f59 100644 +--- a/ethtool.c ++++ b/ethtool.c +@@ -1583,7 +1583,7 @@ static char *tx_type_labels[N_TX_TYPES] = { + "one-step-sync (HWTSTAMP_TX_ONESTEP_SYNC)", + }; + +-#define N_RX_FILTERS (HWTSTAMP_FILTER_PTP_V2_DELAY_REQ + 1) ++#define N_RX_FILTERS (HWTSTAMP_FILTER_NTP_ALL + 1) + + static char *rx_filter_labels[N_RX_FILTERS] = { + "none (HWTSTAMP_FILTER_NONE)", +@@ -1601,6 +1601,7 @@ static char *rx_filter_labels[N_RX_FILTERS] = { + "ptpv2-event (HWTSTAMP_FILTER_PTP_V2_EVENT)", + "ptpv2-sync (HWTSTAMP_FILTER_PTP_V2_SYNC)", + "ptpv2-delay-req (HWTSTAMP_FILTER_PTP_V2_DELAY_REQ)", ++ "ntp-all (HWTSTAMP_FILTER_NTP_ALL)", + }; + + static int dump_tsinfo(const struct ethtool_ts_info *info) +-- +1.8.3.1 + diff --git a/SOURCES/0008-ethtool-copy.h-sync-with-net-next.patch b/SOURCES/0008-ethtool-copy.h-sync-with-net-next.patch new file mode 100644 index 0000000..23c6bb1 --- /dev/null +++ b/SOURCES/0008-ethtool-copy.h-sync-with-net-next.patch @@ -0,0 +1,96 @@ +From 1cfc4bab2c9109f8d9c58344e21da4fa0cae17ca Mon Sep 17 00:00:00 2001 +From: "Allan W. Nielsen" +Date: Thu, 24 Nov 2016 09:56:50 +0100 +Subject: [PATCH 08/11] ethtool-copy.h:sync with net-next + +This covers kernel changes upto: + +commit 607c7029146790201e90b58c4235ddff0304d6e0 +Author: Raju Lakkaraju +Date: Thu Nov 17 13:07:22 2016 +0100 + + ethtool: (uapi) Add ETHTOOL_PHY_DOWNSHIFT to PHY tunables + + For operation in cabling environments that are incompatible with + 1000BASE-T, PHY device may provide an automatic link speed downshift + operation. When enabled, the device automatically changes its 1000BASE-T + auto-negotiation to the next slower speed after a configured number of + failed attempts at 1000BASE-T. This feature is useful in setting up in + networks using older cable installations that include only pairs A and B, + and not pairs C and D. + + Signed-off-by: Raju Lakkaraju + Signed-off-by: Allan W. Nielsen + Reviewed-by: Andrew Lunn + Signed-off-by: David S. Miller + +Signed-off-by: Allan W. Nielsen +Signed-off-by: John W. Linville +(cherry picked from commit af5af00a644e117c573d9afe591f8ce51348953f) +--- + ethtool-copy.h | 21 ++++++++++++++++++--- + 1 file changed, 18 insertions(+), 3 deletions(-) + +diff --git a/ethtool-copy.h b/ethtool-copy.h +index 70748f5..3d299e3 100644 +--- a/ethtool-copy.h ++++ b/ethtool-copy.h +@@ -117,8 +117,7 @@ struct ethtool_cmd { + static __inline__ void ethtool_cmd_speed_set(struct ethtool_cmd *ep, + __u32 speed) + { +- +- ep->speed = (__u16)speed; ++ ep->speed = (__u16)(speed & 0xFFFF); + ep->speed_hi = (__u16)(speed >> 16); + } + +@@ -247,6 +246,19 @@ struct ethtool_tunable { + void *data[0]; + }; + ++#define DOWNSHIFT_DEV_DEFAULT_COUNT 0xff ++#define DOWNSHIFT_DEV_DISABLE 0 ++ ++enum phy_tunable_id { ++ ETHTOOL_PHY_ID_UNSPEC, ++ ETHTOOL_PHY_DOWNSHIFT, ++ /* ++ * Add your fresh new phy tunable attribute above and remember to update ++ * phy_tunable_strings[] in net/core/ethtool.c ++ */ ++ __ETHTOOL_PHY_TUNABLE_COUNT, ++}; ++ + /** + * struct ethtool_regs - hardware register dump + * @cmd: Command number = %ETHTOOL_GREGS +@@ -547,6 +559,7 @@ struct ethtool_pauseparam { + * @ETH_SS_FEATURES: Device feature names + * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names + * @ETH_SS_PHY_STATS: Statistic names, for use with %ETHTOOL_GPHYSTATS ++ * @ETH_SS_PHY_TUNABLES: PHY tunable names + */ + enum ethtool_stringset { + ETH_SS_TEST = 0, +@@ -557,6 +570,7 @@ enum ethtool_stringset { + ETH_SS_RSS_HASH_FUNCS, + ETH_SS_TUNABLES, + ETH_SS_PHY_STATS, ++ ETH_SS_PHY_TUNABLES, + }; + + /** +@@ -1312,7 +1326,8 @@ struct ethtool_per_queue_op { + + #define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */ + #define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */ +- ++#define ETHTOOL_PHY_GTUNABLE 0x0000004e /* Get PHY tunable configuration */ ++#define ETHTOOL_PHY_STUNABLE 0x0000004f /* Set PHY tunable configuration */ + + /* compatibility with older code */ + #define SPARC_ETH_GSET ETHTOOL_GSET +-- +1.8.3.1 + diff --git a/SOURCES/0009-ethtool-Add-support-for-2500baseT-5000baseT-link-mod.patch b/SOURCES/0009-ethtool-Add-support-for-2500baseT-5000baseT-link-mod.patch new file mode 100644 index 0000000..3ee44bc --- /dev/null +++ b/SOURCES/0009-ethtool-Add-support-for-2500baseT-5000baseT-link-mod.patch @@ -0,0 +1,83 @@ +From c5c7c33cb83947523e954c7410216e6b8c0dd942 Mon Sep 17 00:00:00 2001 +From: Pavel Belous +Date: Mon, 30 Jan 2017 20:03:30 +0300 +Subject: [PATCH 09/11] ethtool: Add support for 2500baseT/5000baseT link modes + +This patch introduce ethtool support for 2500BaseT and 5000BaseT link modes +from new IEEE 802.3bz standard. + +ethtool-copy.h file sync with net. + +Signed-off-by: Pavel Belous +Signed-off-by: John W. Linville +(cherry picked from commit 64dfc5e2f0467a4f61c066165eb42c118ca744e3) +--- + ethtool-copy.h | 4 +++- + ethtool.8.in | 4 +++- + ethtool.c | 6 ++++++ + 3 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/ethtool-copy.h b/ethtool-copy.h +index 3d299e3..06fc04c 100644 +--- a/ethtool-copy.h ++++ b/ethtool-copy.h +@@ -1382,6 +1382,8 @@ enum ethtool_link_mode_bit_indices { + ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 44, + ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 45, + ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 46, ++ ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 47, ++ ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 48, + + + /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit +@@ -1391,7 +1393,7 @@ enum ethtool_link_mode_bit_indices { + */ + + __ETHTOOL_LINK_MODE_LAST +- = ETHTOOL_LINK_MODE_10000baseER_Full_BIT, ++ = ETHTOOL_LINK_MODE_5000baseT_Full_BIT, + }; + + #define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \ +diff --git a/ethtool.8.in b/ethtool.8.in +index b69c5c6..eb0f551 100644 +--- a/ethtool.8.in ++++ b/ethtool.8.in +@@ -578,7 +578,9 @@ lB l lB. + 0x020 1000baseT Full + 0x20000 1000baseKX Full + 0x20000000000 1000baseX Full +-0x8000 2500baseX Full (not supported by IEEE standards) ++0x800000000000 2500baseT Full ++0x8000 2500baseX Full (not supported by IEEE standards)' ++0x1000000000000 5000baseT Full + 0x1000 10000baseT Full + 0x40000 10000baseKX4 Full + 0x80000 10000baseKR Full +diff --git a/ethtool.c b/ethtool.c +index 5465f59..9650f54 100644 +--- a/ethtool.c ++++ b/ethtool.c +@@ -529,6 +529,8 @@ static void init_global_link_mode_masks(void) + ETHTOOL_LINK_MODE_10000baseLR_Full_BIT, + ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT, + ETHTOOL_LINK_MODE_10000baseER_Full_BIT, ++ ETHTOOL_LINK_MODE_2500baseT_Full_BIT, ++ ETHTOOL_LINK_MODE_5000baseT_Full_BIT, + }; + static const enum ethtool_link_mode_bit_indices + additional_advertised_flags_bits[] = { +@@ -681,6 +683,10 @@ static void dump_link_caps(const char *prefix, const char *an_prefix, + "10000baseLRM/Full" }, + { 0, ETHTOOL_LINK_MODE_10000baseER_Full_BIT, + "10000baseER/Full" }, ++ { 0, ETHTOOL_LINK_MODE_2500baseT_Full_BIT, ++ "2500baseT/Full" }, ++ { 0, ETHTOOL_LINK_MODE_5000baseT_Full_BIT, ++ "5000baseT/Full" }, + }; + int indent; + int did1, new_line_pend, i; +-- +1.8.3.1 + diff --git a/SOURCES/0010-ethtool.8-Fix-formatting-of-advertise-bitmask.patch b/SOURCES/0010-ethtool.8-Fix-formatting-of-advertise-bitmask.patch new file mode 100644 index 0000000..1dd71ff --- /dev/null +++ b/SOURCES/0010-ethtool.8-Fix-formatting-of-advertise-bitmask.patch @@ -0,0 +1,37 @@ +From f4578eaf711f3d5e15f3e5fdb98cce3ebae80a2b Mon Sep 17 00:00:00 2001 +From: Gal Pressman +Date: Thu, 28 Sep 2017 15:08:52 +0300 +Subject: [PATCH 10/11] ethtool.8: Fix formatting of advertise bitmask + +Fields should be separated with a tab instead of spaces. +Also, remove an accidental ' character from 2500baseX Full mode. + +Fixes: 64dfc5e2f046 ("ethtool: Add support for 2500baseT/5000baseT link modes") +Signed-off-by: Gal Pressman +Reviewed-by: Tariq Toukan +Signed-off-by: John W. Linville +(cherry picked from commit f35a4bcd55164495deb4eef0975a1623d760ff91) +--- + ethtool.8.in | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/ethtool.8.in b/ethtool.8.in +index eb0f551..c7208ab 100644 +--- a/ethtool.8.in ++++ b/ethtool.8.in +@@ -578,9 +578,9 @@ lB l lB. + 0x020 1000baseT Full + 0x20000 1000baseKX Full + 0x20000000000 1000baseX Full +-0x800000000000 2500baseT Full +-0x8000 2500baseX Full (not supported by IEEE standards)' +-0x1000000000000 5000baseT Full ++0x800000000000 2500baseT Full ++0x8000 2500baseX Full (not supported by IEEE standards) ++0x1000000000000 5000baseT Full + 0x1000 10000baseT Full + 0x40000 10000baseKX4 Full + 0x80000 10000baseKR Full +-- +1.8.3.1 + diff --git a/SOURCES/0011-ethtool.8-Document-56000-advertise-link-modes.patch b/SOURCES/0011-ethtool.8-Document-56000-advertise-link-modes.patch new file mode 100644 index 0000000..84c540f --- /dev/null +++ b/SOURCES/0011-ethtool.8-Document-56000-advertise-link-modes.patch @@ -0,0 +1,37 @@ +From 2c64f09bee9b601cb60fd0398f1e4eb1b09a3ebb Mon Sep 17 00:00:00 2001 +From: Gal Pressman +Date: Thu, 28 Sep 2017 15:08:53 +0300 +Subject: [PATCH 11/11] ethtool.8: Document 56000 advertise link modes + +Add the following advertise modes to the manual: +56000baseKR4 Full +56000baseCR4 Full +56000baseSR4 Full +56000baseLR4 Full + +Signed-off-by: Gal Pressman +Reviewed-by: Tariq Toukan +Signed-off-by: John W. Linville +(cherry picked from commit 47c71e3c45cd6e248a25e87cbd8afa201836e59d) +--- + ethtool.8.in | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ethtool.8.in b/ethtool.8.in +index c7208ab..c176cac 100644 +--- a/ethtool.8.in ++++ b/ethtool.8.in +@@ -601,6 +601,10 @@ lB l lB. + 0x400000000 50000baseCR2 Full + 0x800000000 50000baseKR2 Full + 0x10000000000 50000baseSR2 Full ++0x8000000 56000baseKR4 Full ++0x10000000 56000baseCR4 Full ++0x20000000 56000baseSR4 Full ++0x40000000 56000baseLR4 Full + 0x1000000000 100000baseKR4 Full + 0x2000000000 100000baseSR4 Full + 0x4000000000 100000baseCR4 Full +-- +1.8.3.1 + diff --git a/SOURCES/0012-ethtool-Remove-UDP-Fragmentation-Offload-error-print.patch b/SOURCES/0012-ethtool-Remove-UDP-Fragmentation-Offload-error-print.patch new file mode 100644 index 0000000..b9a5edd --- /dev/null +++ b/SOURCES/0012-ethtool-Remove-UDP-Fragmentation-Offload-error-print.patch @@ -0,0 +1,39 @@ +From b41605a9328686d45f6f4ee7791f476866bcc7a9 Mon Sep 17 00:00:00 2001 +From: Shaker Daibes +Date: Mon, 18 Sep 2017 10:35:38 +0300 +Subject: [PATCH 12/12] ethtool: Remove UDP Fragmentation Offload error prints + +UFO was removed in kernel, here we remove UFO error prints when using +"ethtool -k" command. + +Fixes the following issue: +Features for ens8: +Cannot get device udp-fragmentation-offload settings: Operation not +supported + +Signed-off-by: Shaker Daibes +Signed-off-by: Tariq Toukan +Signed-off-by: John W. Linville +(cherry picked from commit d5d35d8331dee79a7453d3ea501bcc7b8b90582c) +--- + ethtool.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ethtool.c b/ethtool.c +index 9650f54..1411d62 100644 +--- a/ethtool.c ++++ b/ethtool.c +@@ -2187,6 +2187,10 @@ get_features(struct cmd_context *ctx, const struct feature_defs *defs) + eval.cmd = off_flag_def[i].get_cmd; + err = send_ioctl(ctx, &eval); + if (err) { ++ if (errno == EOPNOTSUPP && ++ off_flag_def[i].get_cmd == ETHTOOL_GUFO) ++ continue; ++ + fprintf(stderr, + "Cannot get device %s settings: %m\n", + off_flag_def[i].long_name); +-- +1.8.3.1 + diff --git a/SOURCES/0013-ethtool-copy.h-sync-with-net-next.patch b/SOURCES/0013-ethtool-copy.h-sync-with-net-next.patch new file mode 100644 index 0000000..74385ac --- /dev/null +++ b/SOURCES/0013-ethtool-copy.h-sync-with-net-next.patch @@ -0,0 +1,174 @@ +From 3ad39b7b490fc130b47ec248de707d3ae481c9ed Mon Sep 17 00:00:00 2001 +From: Scott Branden +Date: Tue, 12 Dec 2017 12:20:02 -0800 +Subject: [PATCH 13/14] ethtool-copy.h: sync with net-next + +This covers kernel changes up to: + +commit 40e44a1e669d078946f46853808a60d29e6f0885 +Author: Scott Branden +Date: Thu Nov 30 11:35:59 2017 -0800 + + net: ethtool: add support for reset of AP inside NIC interface. + + Add ETH_RESET_AP to reset the application processor(s) inside the NIC + interface. + + Current ETH_RESET_MGMT supports a management processor inside this NIC. + This is typically used for remote NIC management purposes. + + Application processors exist inside some SmartNICs to run various + applications inside the NIC processor - be it a simple algorithm without + an OS to as complex as hosting multiple VMs. + + Signed-off-by: Scott Branden + Reviewed-by: Andrew Lunn + Signed-off-by: David S. Miller + +Signed-off-by: Scott Branden +Signed-off-by: John W. Linville +(cherry picked from commit 83634baa75b5831ed9bfd135f9747b94aacdd842) +--- + ethtool-copy.h | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 61 insertions(+), 5 deletions(-) + +diff --git a/ethtool-copy.h b/ethtool-copy.h +index 06fc04c..f4e7bb2 100644 +--- a/ethtool-copy.h ++++ b/ethtool-copy.h +@@ -1,3 +1,4 @@ ++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ + /* + * ethtool.h: Defines for Linux ethtool. + * +@@ -1236,6 +1237,47 @@ struct ethtool_per_queue_op { + char data[]; + }; + ++/** ++ * struct ethtool_fecparam - Ethernet forward error correction(fec) parameters ++ * @cmd: Command number = %ETHTOOL_GFECPARAM or %ETHTOOL_SFECPARAM ++ * @active_fec: FEC mode which is active on porte ++ * @fec: Bitmask of supported/configured FEC modes ++ * @rsvd: Reserved for future extensions. i.e FEC bypass feature. ++ * ++ * Drivers should reject a non-zero setting of @autoneg when ++ * autoneogotiation is disabled (or not supported) for the link. ++ * ++ */ ++struct ethtool_fecparam { ++ __u32 cmd; ++ /* bitmask of FEC modes */ ++ __u32 active_fec; ++ __u32 fec; ++ __u32 reserved; ++}; ++ ++/** ++ * enum ethtool_fec_config_bits - flags definition of ethtool_fec_configuration ++ * @ETHTOOL_FEC_NONE: FEC mode configuration is not supported ++ * @ETHTOOL_FEC_AUTO: Default/Best FEC mode provided by driver ++ * @ETHTOOL_FEC_OFF: No FEC Mode ++ * @ETHTOOL_FEC_RS: Reed-Solomon Forward Error Detection mode ++ * @ETHTOOL_FEC_BASER: Base-R/Reed-Solomon Forward Error Detection mode ++ */ ++enum ethtool_fec_config_bits { ++ ETHTOOL_FEC_NONE_BIT, ++ ETHTOOL_FEC_AUTO_BIT, ++ ETHTOOL_FEC_OFF_BIT, ++ ETHTOOL_FEC_RS_BIT, ++ ETHTOOL_FEC_BASER_BIT, ++}; ++ ++#define ETHTOOL_FEC_NONE (1 << ETHTOOL_FEC_NONE_BIT) ++#define ETHTOOL_FEC_AUTO (1 << ETHTOOL_FEC_AUTO_BIT) ++#define ETHTOOL_FEC_OFF (1 << ETHTOOL_FEC_OFF_BIT) ++#define ETHTOOL_FEC_RS (1 << ETHTOOL_FEC_RS_BIT) ++#define ETHTOOL_FEC_BASER (1 << ETHTOOL_FEC_BASER_BIT) ++ + /* CMDs currently supported */ + #define ETHTOOL_GSET 0x00000001 /* DEPRECATED, Get settings. + * Please use ETHTOOL_GLINKSETTINGS +@@ -1328,6 +1370,8 @@ struct ethtool_per_queue_op { + #define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */ + #define ETHTOOL_PHY_GTUNABLE 0x0000004e /* Get PHY tunable configuration */ + #define ETHTOOL_PHY_STUNABLE 0x0000004f /* Set PHY tunable configuration */ ++#define ETHTOOL_GFECPARAM 0x00000050 /* Get FEC settings */ ++#define ETHTOOL_SFECPARAM 0x00000051 /* Set FEC settings */ + + /* compatibility with older code */ + #define SPARC_ETH_GSET ETHTOOL_GSET +@@ -1382,9 +1426,12 @@ enum ethtool_link_mode_bit_indices { + ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 44, + ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 45, + ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 46, +- ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 47, +- ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 48, ++ ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 47, ++ ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 48, + ++ ETHTOOL_LINK_MODE_FEC_NONE_BIT = 49, ++ ETHTOOL_LINK_MODE_FEC_RS_BIT = 50, ++ ETHTOOL_LINK_MODE_FEC_BASER_BIT = 51, + + /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit + * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_* +@@ -1393,7 +1440,7 @@ enum ethtool_link_mode_bit_indices { + */ + + __ETHTOOL_LINK_MODE_LAST +- = ETHTOOL_LINK_MODE_5000baseT_Full_BIT, ++ = ETHTOOL_LINK_MODE_FEC_BASER_BIT, + }; + + #define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \ +@@ -1484,13 +1531,17 @@ enum ethtool_link_mode_bit_indices { + * it was forced up into this mode or autonegotiated. + */ + +-/* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. */ ++/* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. ++ * Update drivers/net/phy/phy.c:phy_speed_to_str() and ++ * drivers/net/bonding/bond_3ad.c:__get_link_speed() when adding new values. ++ */ + #define SPEED_10 10 + #define SPEED_100 100 + #define SPEED_1000 1000 + #define SPEED_2500 2500 + #define SPEED_5000 5000 + #define SPEED_10000 10000 ++#define SPEED_14000 14000 + #define SPEED_20000 20000 + #define SPEED_25000 25000 + #define SPEED_40000 40000 +@@ -1633,6 +1684,7 @@ enum ethtool_reset_flags { + ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */ + ETH_RESET_RAM = 1 << 7, /* RAM shared between + * multiple components */ ++ ETH_RESET_AP = 1 << 8, /* Application processor */ + + ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to + * this interface */ +@@ -1701,6 +1753,8 @@ enum ethtool_reset_flags { + * %ethtool_link_mode_bit_indices for the link modes, and other + * link features that the link partner advertised through + * autonegotiation; 0 if unknown or not applicable. Read-only. ++ * @transceiver: Used to distinguish different possible PHY types, ++ * reported consistently by PHYLIB. Read-only. + * + * If autonegotiation is disabled, the speed and @duplex represent the + * fixed link mode and are writable if the driver supports multiple +@@ -1752,7 +1806,9 @@ struct ethtool_link_settings { + __u8 eth_tp_mdix; + __u8 eth_tp_mdix_ctrl; + __s8 link_mode_masks_nwords; +- __u32 reserved[8]; ++ __u8 transceiver; ++ __u8 reserved1[3]; ++ __u32 reserved[7]; + __u32 link_mode_masks[0]; + /* layout of link_mode_masks fields: + * __u32 map_supported[link_mode_masks_nwords]; +-- +1.8.3.1 + diff --git a/SOURCES/0014-ethtool-Support-for-FEC-encoding-control.patch b/SOURCES/0014-ethtool-Support-for-FEC-encoding-control.patch new file mode 100644 index 0000000..c23b8c7 --- /dev/null +++ b/SOURCES/0014-ethtool-Support-for-FEC-encoding-control.patch @@ -0,0 +1,298 @@ +From 6477a1f47b15c2a81a9995397942a0fc17f0b06f Mon Sep 17 00:00:00 2001 +From: Dustin Byford +Date: Mon, 18 Dec 2017 14:57:41 -0800 +Subject: [PATCH 14/14] ethtool: Support for FEC encoding control + +As FEC settings and different FEC modes are mandatory +and configurable across various interfaces of 25G/50G/100G/40G, +the lack of FEC encoding control and reporting today is a source +for interoperability issues for many vendors + +set-fec/show-fec option(s) are designed to provide control and report +the FEC encoding on the link. + +$ethtool --set-fec swp1 encoding [off | RS | BaseR | auto] + +Encoding: Types of encoding +Off : Turning off FEC +RS : Force RS-FEC encoding +BaseR : Force BaseR encoding +Auto : Default FEC settings for drivers, and would represent + asking the hardware to essentially go into a best effort mode. + +Here are a few examples of what we would expect if encoding=auto: +- if autoneg is on, we are expecting FEC to be negotiated as on or off + as long as protocol supports it +- if the hardware is capable of detecting the FEC encoding on it's + receiver it will reconfigure its encoder to match +- in absence of the above, the configuration would be set to IEEE + defaults. + +>From our understanding, this is essentially what most hardware/driver +combinations are doing today in the absence of a way for users to +control the behavior. + +$ethtool --show-fec swp1 +FEC parameters for swp1: +FEC encodings: RS + +ethtool devname output: +$ethtool swp1 +Settings for swp1: +root@hpe-7712-03:~# ethtool swp18 +Settings for swp18: + Supported ports: [ FIBRE ] + Supported link modes: 40000baseCR4/Full + 40000baseSR4/Full + 40000baseLR4/Full + 100000baseSR4/Full + 100000baseCR4/Full + 100000baseLR4_ER4/Full + Supported pause frame use: No + Supports auto-negotiation: Yes + Supported FEC modes: [RS | BaseR | None | Not reported] + Advertised link modes: Not reported + Advertised pause frame use: No + Advertised auto-negotiation: No + Advertised FEC modes: [RS | BaseR | None | Not reported] + Speed: 100000Mb/s + Duplex: Full + Port: FIBRE + PHYAD: 106 + Transceiver: internal + Auto-negotiation: off + Link detected: yes + +Signed-off-by: Vidya Sagar Ravipati +Signed-off-by: Dustin Byford +[code style + man page edits + commit message update] +Signed-off-by: Dirk van der Merwe +Signed-off-by: John W. Linville + +(cherry picked from commit 8db75d1e4001ac4cdfc73d5bedd0ec6d58a3d617) + +Conflicts: + ethtool.8.in + ethtool.c +--- + ethtool.8.in | 31 ++++++++++++++++ + ethtool.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 150 insertions(+) + +diff --git a/ethtool.8.in b/ethtool.8.in +index c176cac..6816020 100644 +--- a/ethtool.8.in ++++ b/ethtool.8.in +@@ -342,6 +342,13 @@ ethtool \- query or control network driver and hardware settings + .B2 tx-lpi on off + .BN tx-timer + .BN advertise ++.HP ++.B ethtool \-\-show\-fec ++.I devname ++.HP ++.B ethtool \-\-set\-fec ++.I devname ++.B4 encoding auto off rs baser + . + .\" Adjust lines (i.e. full justification) and hyphenate. + .ad +@@ -959,6 +966,30 @@ Values are as for + 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 enabled. + .RE ++.TP ++.B \-\-show\-fec ++Queries the specified network device for its support of Forward Error Correction. ++.TP ++.B \-\-set\-fec ++Configures Forward Error Correction for the specified network device. ++ ++Forward Error Correction modes selected by a user are expected to be persisted ++after any hotplug events. If a module is swapped that does not support the ++current FEC mode, the driver or firmware must take the link down ++administratively and report the problem in the system logs for users to correct. ++.RS 4 ++.TP ++.A4 encoding auto off rs baser ++Sets the FEC encoding for the device. ++.TS ++nokeep; ++lB l. ++auto Use the driver's default encoding ++off Turn off FEC ++RS Force RS-FEC encoding ++BaseR Force BaseR encoding ++.TE ++.RE + .SH BUGS + Not supported (in part or whole) on all network drivers. + .SH AUTHOR +diff --git a/ethtool.c b/ethtool.c +index 1411d62..2e9ee2c 100644 +--- a/ethtool.c ++++ b/ethtool.c +@@ -543,6 +543,9 @@ static void init_global_link_mode_masks(void) + ETHTOOL_LINK_MODE_Pause_BIT, + ETHTOOL_LINK_MODE_Asym_Pause_BIT, + ETHTOOL_LINK_MODE_Backplane_BIT, ++ ETHTOOL_LINK_MODE_FEC_NONE_BIT, ++ ETHTOOL_LINK_MODE_FEC_RS_BIT, ++ ETHTOOL_LINK_MODE_FEC_BASER_BIT, + }; + unsigned int i; + +@@ -690,6 +693,7 @@ static void dump_link_caps(const char *prefix, const char *an_prefix, + }; + int indent; + int did1, new_line_pend, i; ++ int fecreported = 0; + + /* Indent just like the separate functions used to */ + indent = strlen(prefix) + 14; +@@ -741,6 +745,26 @@ static void dump_link_caps(const char *prefix, const char *an_prefix, + fprintf(stdout, "Yes\n"); + else + fprintf(stdout, "No\n"); ++ ++ fprintf(stdout, " %s FEC modes:", prefix); ++ if (ethtool_link_mode_test_bit(ETHTOOL_LINK_MODE_FEC_NONE_BIT, ++ mask)) { ++ fprintf(stdout, " None"); ++ fecreported = 1; ++ } ++ if (ethtool_link_mode_test_bit(ETHTOOL_LINK_MODE_FEC_BASER_BIT, ++ mask)) { ++ fprintf(stdout, " BaseR"); ++ fecreported = 1; ++ } ++ if (ethtool_link_mode_test_bit(ETHTOOL_LINK_MODE_FEC_RS_BIT, ++ mask)) { ++ fprintf(stdout, " RS"); ++ fecreported = 1; ++ } ++ if (!fecreported) ++ fprintf(stdout, " Not reported"); ++ fprintf(stdout, "\n"); + } + } + +@@ -1569,6 +1593,20 @@ static void dump_eeecmd(struct ethtool_eee *ep) + dump_link_caps("Link partner advertised EEE", "", link_mode, 1); + } + ++static void dump_fec(u32 fec) ++{ ++ if (fec & ETHTOOL_FEC_NONE) ++ fprintf(stdout, " None"); ++ if (fec & ETHTOOL_FEC_AUTO) ++ fprintf(stdout, " Auto"); ++ if (fec & ETHTOOL_FEC_OFF) ++ fprintf(stdout, " Off"); ++ if (fec & ETHTOOL_FEC_BASER) ++ fprintf(stdout, " BaseR"); ++ if (fec & ETHTOOL_FEC_RS) ++ fprintf(stdout, " RS"); ++} ++ + #define N_SOTS 7 + + static char *so_timestamping_labels[N_SOTS] = { +@@ -4592,6 +4630,84 @@ static int do_seee(struct cmd_context *ctx) + return 0; + } + ++static int fecmode_str_to_type(const char *str) ++{ ++ int fecmode = 0; ++ ++ if (!str) ++ return fecmode; ++ ++ if (!strcasecmp(str, "auto")) ++ fecmode |= ETHTOOL_FEC_AUTO; ++ else if (!strcasecmp(str, "off")) ++ fecmode |= ETHTOOL_FEC_OFF; ++ else if (!strcasecmp(str, "rs")) ++ fecmode |= ETHTOOL_FEC_RS; ++ else if (!strcasecmp(str, "baser")) ++ fecmode |= ETHTOOL_FEC_BASER; ++ ++ return fecmode; ++} ++ ++static int do_gfec(struct cmd_context *ctx) ++{ ++ struct ethtool_fecparam feccmd = { 0 }; ++ int rv; ++ ++ if (ctx->argc != 0) ++ exit_bad_args(); ++ ++ feccmd.cmd = ETHTOOL_GFECPARAM; ++ rv = send_ioctl(ctx, &feccmd); ++ if (rv != 0) { ++ perror("Cannot get FEC settings"); ++ return rv; ++ } ++ ++ fprintf(stdout, "FEC parameters for %s:\n", ctx->devname); ++ fprintf(stdout, "Configured FEC encodings:"); ++ dump_fec(feccmd.fec); ++ fprintf(stdout, "\n"); ++ ++ fprintf(stdout, "Active FEC encoding:"); ++ dump_fec(feccmd.active_fec); ++ fprintf(stdout, "\n"); ++ ++ return 0; ++} ++ ++static int do_sfec(struct cmd_context *ctx) ++{ ++ char *fecmode_str = NULL; ++ struct ethtool_fecparam feccmd; ++ struct cmdline_info cmdline_fec[] = { ++ { "encoding", CMDL_STR, &fecmode_str, &feccmd.fec}, ++ }; ++ int changed; ++ int fecmode; ++ int rv; ++ ++ parse_generic_cmdline(ctx, &changed, cmdline_fec, ++ ARRAY_SIZE(cmdline_fec)); ++ ++ if (!fecmode_str) ++ exit_bad_args(); ++ ++ fecmode = fecmode_str_to_type(fecmode_str); ++ if (!fecmode) ++ exit_bad_args(); ++ ++ feccmd.cmd = ETHTOOL_SFECPARAM; ++ feccmd.fec = fecmode; ++ rv = send_ioctl(ctx, &feccmd); ++ if (rv != 0) { ++ perror("Cannot set FEC settings"); ++ return rv; ++ } ++ ++ return 0; ++} ++ + #ifndef TEST_ETHTOOL + int send_ioctl(struct cmd_context *ctx, void *cmd) + { +@@ -4754,6 +4870,9 @@ static const struct option { + " [ advertise %x ]\n" + " [ tx-lpi on|off ]\n" + " [ tx-timer %d ]\n"}, ++ { "--show-fec", 1, do_gfec, "Show FEC settings"}, ++ { "--set-fec", 1, do_sfec, "Set FEC settings", ++ " [ encoding auto|off|rs|baser ]\n"}, + { "-h|--help", 0, show_usage, "Show this help" }, + { "--version", 0, do_version, "Show version number" }, + {} +-- +1.8.3.1 + diff --git a/SPECS/ethtool.spec b/SPECS/ethtool.spec index 3373cfd..03936c1 100644 --- a/SPECS/ethtool.spec +++ b/SPECS/ethtool.spec @@ -1,7 +1,7 @@ Name: ethtool Epoch: 2 Version: 4.8 -Release: 1%{?dist} +Release: 7%{?dist} Summary: Settings tool for Ethernet NICs License: GPLv2 @@ -24,6 +24,17 @@ Conflicts: filesystem < 3 Patch0: 0001-ethtool-add-register-dump-support-for-fjes-driver.patch Patch1: 0002-ethtool-sync-help-output-for-x-X-with-man-page.patch Patch2: 0003-ethtool-Fix-the-advertise-parameter-logic.patch +Patch3: 0004-ethtool-Fix-SFF-8079-cable-technology-bit-parsing.patch +Patch4: 0005-ethtool-Support-for-configurable-RSS-hash-function.patch +Patch5: 0006-net_tstamp.h-sync-with-net-next.patch +Patch6: 0007-ethtool-add-support-for-HWTSTAMP_FILTER_NTP_ALL.patch +Patch7: 0008-ethtool-copy.h-sync-with-net-next.patch +Patch8: 0009-ethtool-Add-support-for-2500baseT-5000baseT-link-mod.patch +Patch9: 0010-ethtool.8-Fix-formatting-of-advertise-bitmask.patch +Patch10: 0011-ethtool.8-Document-56000-advertise-link-modes.patch +Patch11: 0012-ethtool-Remove-UDP-Fragmentation-Offload-error-print.patch +Patch12: 0013-ethtool-copy.h-sync-with-net-next.patch +Patch13: 0014-ethtool-Support-for-FEC-encoding-control.patch %description This utility allows querying and changing settings such as speed, @@ -35,6 +46,17 @@ network devices, especially of Ethernet devices. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 # Only needed when using upstream git # aclocal @@ -57,6 +79,26 @@ make DESTDIR=%{buildroot} INSTALL='install -p' install %{_mandir}/man8/%{name}.8* %changelog +* Wed Jan 10 2018 Ivan Vecera - 2:4.8-7 +- Fixed synopsis in ethtool man page + +* Tue Jan 9 2018 Ivan Vecera - 2:4.8-6 +- Added support for setting FEC parameters + +* Fri Jan 5 2018 Ivan Vecera - 2:4.8-5 +- Fixed changelog + +* Fri Jan 5 2018 Ivan Vecera - 2:4.8-4 +- Fixed UDP fragmentation offloading error messages printed on kernel-alt >=4.14 + +* Tue Nov 14 2017 Ivan Vecera - 2:4.8-3 +- Added support for 2500baseT/5000baseT link modes + +* Fri Nov 3 2017 Ivan Vecera - 2:4.8-2 +- Added support for configurable RSS hash function +- Fixed SFF 8079 cable technology bit parsing +- Added support for HWTSTAMP_FILTER_NTP_ALL + * Wed Mar 22 2017 Ivan Vecera - 2:4.8-1 - Rebased against upstream v4.8