149f89
From 1cfc4bab2c9109f8d9c58344e21da4fa0cae17ca Mon Sep 17 00:00:00 2001
149f89
From: "Allan W. Nielsen" <allan.nielsen@microsemi.com>
149f89
Date: Thu, 24 Nov 2016 09:56:50 +0100
149f89
Subject: [PATCH 08/11] ethtool-copy.h:sync with net-next
149f89
149f89
This covers kernel changes upto:
149f89
149f89
commit 607c7029146790201e90b58c4235ddff0304d6e0
149f89
Author: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
149f89
Date:   Thu Nov 17 13:07:22 2016 +0100
149f89
149f89
    ethtool: (uapi) Add ETHTOOL_PHY_DOWNSHIFT to PHY tunables
149f89
149f89
    For operation in cabling environments that are incompatible with
149f89
    1000BASE-T, PHY device may provide an automatic link speed downshift
149f89
    operation. When enabled, the device automatically changes its 1000BASE-T
149f89
    auto-negotiation to the next slower speed after a configured number of
149f89
    failed attempts at 1000BASE-T.  This feature is useful in setting up in
149f89
    networks using older cable installations that include only pairs A and B,
149f89
    and not pairs C and D.
149f89
149f89
    Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
149f89
    Signed-off-by: Allan W. Nielsen <allan.nielsen@microsemi.com>
149f89
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
149f89
    Signed-off-by: David S. Miller <davem@davemloft.net>
149f89
149f89
Signed-off-by: Allan W. Nielsen <allan.nielsen@microsemi.com>
149f89
Signed-off-by: John W. Linville <linville@tuxdriver.com>
149f89
(cherry picked from commit af5af00a644e117c573d9afe591f8ce51348953f)
149f89
---
149f89
 ethtool-copy.h | 21 ++++++++++++++++++---
149f89
 1 file changed, 18 insertions(+), 3 deletions(-)
149f89
149f89
diff --git a/ethtool-copy.h b/ethtool-copy.h
149f89
index 70748f5..3d299e3 100644
149f89
--- a/ethtool-copy.h
149f89
+++ b/ethtool-copy.h
149f89
@@ -117,8 +117,7 @@ struct ethtool_cmd {
149f89
 static __inline__ void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
149f89
 					 __u32 speed)
149f89
 {
149f89
-
149f89
-	ep->speed = (__u16)speed;
149f89
+	ep->speed = (__u16)(speed & 0xFFFF);
149f89
 	ep->speed_hi = (__u16)(speed >> 16);
149f89
 }
149f89
 
149f89
@@ -247,6 +246,19 @@ struct ethtool_tunable {
149f89
 	void	*data[0];
149f89
 };
149f89
 
149f89
+#define DOWNSHIFT_DEV_DEFAULT_COUNT	0xff
149f89
+#define DOWNSHIFT_DEV_DISABLE		0
149f89
+
149f89
+enum phy_tunable_id {
149f89
+	ETHTOOL_PHY_ID_UNSPEC,
149f89
+	ETHTOOL_PHY_DOWNSHIFT,
149f89
+	/*
149f89
+	 * Add your fresh new phy tunable attribute above and remember to update
149f89
+	 * phy_tunable_strings[] in net/core/ethtool.c
149f89
+	 */
149f89
+	__ETHTOOL_PHY_TUNABLE_COUNT,
149f89
+};
149f89
+
149f89
 /**
149f89
  * struct ethtool_regs - hardware register dump
149f89
  * @cmd: Command number = %ETHTOOL_GREGS
149f89
@@ -547,6 +559,7 @@ struct ethtool_pauseparam {
149f89
  * @ETH_SS_FEATURES: Device feature names
149f89
  * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names
149f89
  * @ETH_SS_PHY_STATS: Statistic names, for use with %ETHTOOL_GPHYSTATS
149f89
+ * @ETH_SS_PHY_TUNABLES: PHY tunable names
149f89
  */
149f89
 enum ethtool_stringset {
149f89
 	ETH_SS_TEST		= 0,
149f89
@@ -557,6 +570,7 @@ enum ethtool_stringset {
149f89
 	ETH_SS_RSS_HASH_FUNCS,
149f89
 	ETH_SS_TUNABLES,
149f89
 	ETH_SS_PHY_STATS,
149f89
+	ETH_SS_PHY_TUNABLES,
149f89
 };
149f89
 
149f89
 /**
149f89
@@ -1312,7 +1326,8 @@ struct ethtool_per_queue_op {
149f89
 
149f89
 #define ETHTOOL_GLINKSETTINGS	0x0000004c /* Get ethtool_link_settings */
149f89
 #define ETHTOOL_SLINKSETTINGS	0x0000004d /* Set ethtool_link_settings */
149f89
-
149f89
+#define ETHTOOL_PHY_GTUNABLE	0x0000004e /* Get PHY tunable configuration */
149f89
+#define ETHTOOL_PHY_STUNABLE	0x0000004f /* Set PHY tunable configuration */
149f89
 
149f89
 /* compatibility with older code */
149f89
 #define SPARC_ETH_GSET		ETHTOOL_GSET
149f89
-- 
149f89
1.8.3.1
149f89