backports: handle struct ethtool_cmd MDI changes
authorStefan Assmann <sassmann@kpanic.de>
Fri, 16 May 2014 11:21:22 +0000 (13:21 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 1 Jun 2014 22:16:15 +0000 (00:16 +0200)
In kernel 3.7 struct ethtool_cmd received eth_tp_mdix and eth_tp_mdix_ctrl.
Address this by putting ifdef around the code using these struct components.

commit 6f6bbc186dc8e4e0c628db7decbd1a5e02cb5fd8
Author: Jesse Brandeburg <jesse.brandeburg@intel.com>
Date:   Thu Jul 26 02:30:53 2012 +0000

    ethtool.h: MDI setting support

git describe --contains 6f6bbc186dc8e4e0c628db7decbd1a5e02cb5fd8
v3.7-rc1~145^2~300^2~5

Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
patches/collateral-evolutions/network/0040-ethtool_cmd_mdix/INFO [new file with mode: 0644]
patches/collateral-evolutions/network/0040-ethtool_cmd_mdix/igb_ethtool_cmd_mdix.patch [new file with mode: 0644]

diff --git a/patches/collateral-evolutions/network/0040-ethtool_cmd_mdix/INFO b/patches/collateral-evolutions/network/0040-ethtool_cmd_mdix/INFO
new file mode 100644 (file)
index 0000000..21e4add
--- /dev/null
@@ -0,0 +1,13 @@
+In kernel 3.7 struct ethtool_cmd received eth_tp_mdix and eth_tp_mdix_ctrl.
+Address this by putting ifdef around the code using these struct components.
+
+
+commit 6f6bbc186dc8e4e0c628db7decbd1a5e02cb5fd8
+Author: Jesse Brandeburg <jesse.brandeburg@intel.com>
+Date:   Thu Jul 26 02:30:53 2012 +0000
+
+    ethtool.h: MDI setting support
+
+git describe --contains 6f6bbc186dc8e4e0c628db7decbd1a5e02cb5fd8
+v3.7-rc1~145^2~300^2~5
+
diff --git a/patches/collateral-evolutions/network/0040-ethtool_cmd_mdix/igb_ethtool_cmd_mdix.patch b/patches/collateral-evolutions/network/0040-ethtool_cmd_mdix/igb_ethtool_cmd_mdix.patch
new file mode 100644 (file)
index 0000000..5783b3f
--- /dev/null
@@ -0,0 +1,49 @@
+diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
+index f561b7b..b611f5b 100644
+--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
++++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
+@@ -245,10 +245,12 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
+       else
+               ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
+       if (hw->phy.mdix == AUTO_ALL_MODES)
+               ecmd->eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO;
+       else
+               ecmd->eth_tp_mdix_ctrl = hw->phy.mdix;
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) */
+       return 0;
+ }
+@@ -267,6 +269,7 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
+               return -EINVAL;
+       }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
+       /* MDI setting is only allowed when autoneg enabled because
+        * some hardware doesn't allow MDI setting when speed or
+        * duplex is forced.
+@@ -281,6 +284,7 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
+                       return -EINVAL;
+               }
+       }
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) */
+       while (test_and_set_bit(__IGB_RESETTING, &adapter->state))
+               usleep_range(1000, 2000);
+@@ -324,6 +328,7 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
+               }
+       }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
+       /* MDI-X => 2; MDI => 1; Auto => 3 */
+       if (ecmd->eth_tp_mdix_ctrl) {
+               /* fix up the value for auto (3 => 0) as zero is mapped
+@@ -334,6 +339,7 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
+               else
+                       hw->phy.mdix = ecmd->eth_tp_mdix_ctrl;
+       }
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) */
+       /* reset the link */
+       if (netif_running(adapter->netdev)) {