]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/ixgbe/ixgbe_ethtool.c
ixgbe: add device support for 82598AT (copper 10GbE) adapters
[karo-tx-linux.git] / drivers / net / ixgbe / ixgbe_ethtool.c
index 81a9c4b8672683a8033ef5e73e3a4096e5e7a724..fee56a383819100910271df3b668b9866145d28f 100644 (file)
@@ -149,6 +149,8 @@ static int ixgbe_set_settings(struct net_device *netdev,
 {
        struct ixgbe_adapter *adapter = netdev_priv(netdev);
        struct ixgbe_hw *hw = &adapter->hw;
+       u32 advertised, old;
+       s32 err;
 
        switch (hw->phy.media_type) {
        case ixgbe_media_type_fiber:
@@ -157,6 +159,31 @@ static int ixgbe_set_settings(struct net_device *netdev,
                        return -EINVAL;
                /* in this case we currently only support 10Gb/FULL */
                break;
+       case ixgbe_media_type_copper:
+               /* 10000/copper and 1000/copper must autoneg
+                * this function does not support any duplex forcing, but can
+                * limit the advertising of the adapter to only 10000 or 1000 */
+               if (ecmd->autoneg == AUTONEG_DISABLE)
+                       return -EINVAL;
+
+               old = hw->phy.autoneg_advertised;
+               advertised = 0;
+               if (ecmd->advertising & ADVERTISED_10000baseT_Full)
+                       advertised |= IXGBE_LINK_SPEED_10GB_FULL;
+
+               if (ecmd->advertising & ADVERTISED_1000baseT_Full)
+                       advertised |= IXGBE_LINK_SPEED_1GB_FULL;
+
+               if (old == advertised)
+                       break;
+               /* this sets the link speed and restarts auto-neg */
+               err = hw->mac.ops.setup_link_speed(hw, advertised, true, true);
+               if (err) {
+                       DPRINTK(PROBE, INFO,
+                               "setup link failed with code %d\n", err);
+                       hw->mac.ops.setup_link_speed(hw, old, true, true);
+               }
+               break;
        default:
                break;
        }