e1000e: return appropriate errors for 'ethtool -r'
authorBruce Allan <bruce.w.allan@intel.com>
Thu, 20 Jan 2011 06:58:07 +0000 (06:58 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 11 Feb 2011 16:42:15 +0000 (08:42 -0800)
...when invoked while interface is not up or when auto-negotiation is
disabled as done by other drivers.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/e1000e/ethtool.c

index 0c085992546836ce583700c052043a37a3b7157c..65ef9b5548d802fa03509fe50c290c95affd60d6 100644 (file)
@@ -1963,8 +1963,15 @@ static int e1000_set_coalesce(struct net_device *netdev,
 static int e1000_nway_reset(struct net_device *netdev)
 {
        struct e1000_adapter *adapter = netdev_priv(netdev);
-       if (netif_running(netdev))
-               e1000e_reinit_locked(adapter);
+
+       if (!netif_running(netdev))
+               return -EAGAIN;
+
+       if (!adapter->hw.mac.autoneg)
+               return -EINVAL;
+
+       e1000e_reinit_locked(adapter);
+
        return 0;
 }