From: Eyal Grossman <eyalgr@mellanox.com>
Date: Sun, 25 Jan 2015 15:51:20 +0200
Subject: ethtool: Add missing Advertised speeds
Patch-mainline: v4.0
Git-commit: b55a631d5ace86517508151dda491ffd40ad7e4b
References: bsc#927309 bsc#924311

Added the following missing advertised speed modes:
- ADVERTISED_10000baseT_Full
- ADVERTISED_56000baseKR4_Full
- ADVERTISED_56000baseCR4_Full
- ADVERTISED_56000baseSR4_Full
- ADVERTISED_56000baseLR4_Full
- ADVERTISED_10000baseKX4_Full

In order to reduce code duplication we added a macro to
ALL_ADVERTISED_FLAGS in line 88 ALL_ADVERTISED_MODES,
in addition the changed we made added speed that were
missing from ALL_ADVERTISED_MODES
(e.g. ADVERTISED_10000baseKX4_Full).

Signed-off-by: Eyal Grossman <eyalgr@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
[bwh: Dropped two slightly related changes from this, that I didn't like]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>

---
 ethtool.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 85 insertions(+), 1 deletion(-)

diff --git a/ethtool.c b/ethtool.c
index 2a996452f49f..1db4f538a61a 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -1297,6 +1297,13 @@ static void dump_supported(struct ethtool_cmd *ep)
 	if (mask & SUPPORTED_10000baseKR_Full) {
 		did1++; fprintf(stdout, "10000baseKR/Full ");
 	}
+	if (did1 && (mask & SUPPORTED_10000baseR_FEC)) {
+		fprintf(stdout, "\n");
+		fprintf(stdout, "	                        ");
+	}
+	if (mask & SUPPORTED_10000baseR_FEC) {
+		did1++; fprintf(stdout, "10000baseR_FEC ");
+	}
 	if (did1 && (mask & SUPPORTED_20000baseMLD2_Full)) {
 		fprintf(stdout, "\n");
 		fprintf(stdout, "	                        ");
@@ -1339,6 +1346,34 @@ static void dump_supported(struct ethtool_cmd *ep)
 	if (mask & SUPPORTED_40000baseLR4_Full) {
 		did1++; fprintf(stdout, "40000baseLR4/Full");
 	}
+	if (did1 && (mask & SUPPORTED_56000baseKR4_Full)) {
+		fprintf(stdout, "\n");
+		fprintf(stdout, "	                        ");
+	}
+	if (mask & SUPPORTED_56000baseKR4_Full) {
+		did1++; fprintf(stdout, "56000baseKR4/Full");
+	}
+	if (did1 && (mask & SUPPORTED_56000baseCR4_Full)) {
+		fprintf(stdout, "\n");
+		fprintf(stdout, "	                        ");
+	}
+	if (mask & SUPPORTED_56000baseCR4_Full) {
+		did1++; fprintf(stdout, "56000baseCR4/Full");
+	}
+	if (did1 && (mask & SUPPORTED_56000baseSR4_Full)) {
+		fprintf(stdout, "\n");
+		fprintf(stdout, "	                        ");
+	}
+	if (mask & SUPPORTED_56000baseSR4_Full) {
+		did1++; fprintf(stdout, "56000baseSR4/Full");
+	}
+	if (did1 && (mask & SUPPORTED_56000baseLR4_Full)) {
+		fprintf(stdout, "\n");
+		fprintf(stdout, "	                        ");
+	}
+	if (mask & SUPPORTED_56000baseLR4_Full) {
+		did1++; fprintf(stdout, "56000baseLR4/Full");
+	}
 	fprintf(stdout, "\n");
 
 	fprintf(stdout, "	Supports auto-negotiation: ");
@@ -1417,6 +1452,13 @@ static void dump_advertised(struct ethtool_cmd *ep,
 	if (mask & ADVERTISED_10000baseKR_Full) {
 		did1++; fprintf(stdout, "10000baseKR/Full ");
 	}
+	if (did1 && (mask & ADVERTISED_10000baseR_FEC)) {
+		fprintf(stdout, "\n");
+		fprintf(stdout, "	%*s", indent, "");
+	}
+	if (mask & ADVERTISED_10000baseR_FEC) {
+		did1++; fprintf(stdout, "10000baseR_FEC ");
+	}
 	if (did1 && (mask & ADVERTISED_20000baseMLD2_Full)) {
 		fprintf(stdout, "\n");
 		fprintf(stdout, "	%*s", indent, "");
@@ -1459,6 +1501,34 @@ static void dump_advertised(struct ethtool_cmd *ep,
 	if (mask & ADVERTISED_40000baseLR4_Full) {
 		did1++; fprintf(stdout, "40000baseLR4/Full");
 	}
+	if (did1 && (mask & ADVERTISED_56000baseKR4_Full)) {
+		fprintf(stdout, "\n");
+		fprintf(stdout, "	%*s", indent, "");
+	}
+	if (mask & ADVERTISED_56000baseKR4_Full) {
+		did1++; fprintf(stdout, "56000baseKR4/Full");
+	}
+	if (did1 && (mask & ADVERTISED_56000baseCR4_Full)) {
+		fprintf(stdout, "\n");
+		fprintf(stdout, "	%*s", indent, "");
+	}
+	if (mask & ADVERTISED_56000baseCR4_Full) {
+		did1++; fprintf(stdout, "56000baseCR4/Full");
+	}
+	if (did1 && (mask & ADVERTISED_56000baseSR4_Full)) {
+		fprintf(stdout, "\n");
+		fprintf(stdout, "	%*s", indent, "");
+	}
+	if (mask & ADVERTISED_56000baseSR4_Full) {
+		did1++; fprintf(stdout, "56000baseSR4/Full");
+	}
+	if (did1 && (mask & ADVERTISED_56000baseLR4_Full)) {
+		fprintf(stdout, "\n");
+		fprintf(stdout, "	%*s", indent, "");
+	}
+	if (mask & ADVERTISED_56000baseLR4_Full) {
+		did1++; fprintf(stdout, "56000baseLR4/Full");
+	}
 	if (did1 == 0)
 		 fprintf(stdout, "Not reported");
 	fprintf(stdout, "\n");
@@ -2935,8 +3005,22 @@ static int do_sset(int fd, struct ifreq *ifr)
 					 ADVERTISED_100baseT_Full |
 					 ADVERTISED_1000baseT_Half |
 					 ADVERTISED_1000baseT_Full |
+					 ADVERTISED_1000baseKX_Full |
 					 ADVERTISED_2500baseX_Full |
-					 ADVERTISED_10000baseT_Full);
+					 ADVERTISED_10000baseT_Full |
+					 ADVERTISED_10000baseKX4_Full |
+					 ADVERTISED_10000baseKR_Full |
+					 ADVERTISED_10000baseR_FEC |
+					 ADVERTISED_20000baseMLD2_Full |
+					 ADVERTISED_20000baseKR2_Full |
+					 ADVERTISED_40000baseKR4_Full |
+					 ADVERTISED_40000baseCR4_Full |
+					 ADVERTISED_40000baseSR4_Full |
+					 ADVERTISED_40000baseLR4_Full |
+					 ADVERTISED_56000baseKR4_Full |
+					 ADVERTISED_56000baseCR4_Full |
+					 ADVERTISED_56000baseSR4_Full |
+					 ADVERTISED_56000baseLR4_Full);
 			} else if (advertising_wanted > 0) {
 				ecmd.advertising = advertising_wanted;
 			}
-- 
2.5.1

