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