From 318a94d68979cbe9cc98a3050b4b7be2f08513c8 Mon Sep 17 00:00:00 2001 From: Jeff Kirsher Date: Fri, 28 Mar 2008 09:15:16 -0700 Subject: e1000e: reorganize PHY and flow control interface This reorganization moves the PHY status into a separate struct. Flow Control setup is moved into this struct as well and frame size away from here into the adapter struct where its inly use is. The post-link-up code is now a separate function and moved out of the watchdog function itself. This allows us to track the es2lan restart issue a bit easier. Signed-off-by: Jeff Kirsher Signed-off-by: Bruce Allan Signed-off-by: Jesse Brandeburg Signed-off-by: Auke Kok Signed-off-by: Jeff Garzik --- drivers/net/e1000e/ethtool.c | 64 +++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 31 deletions(-) (limited to 'drivers/net/e1000e/ethtool.c') diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 3b94a87b527..4ae00567bba 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c @@ -111,7 +111,7 @@ static int e1000_get_settings(struct net_device *netdev, struct e1000_hw *hw = &adapter->hw; u32 status; - if (hw->media_type == e1000_media_type_copper) { + if (hw->phy.media_type == e1000_media_type_copper) { ecmd->supported = (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | @@ -165,7 +165,7 @@ static int e1000_get_settings(struct net_device *netdev, ecmd->duplex = -1; } - ecmd->autoneg = ((hw->media_type == e1000_media_type_fiber) || + ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) || hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE; return 0; } @@ -187,7 +187,7 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx) mac->autoneg = 0; /* Fiber NICs only allow 1000 gbps Full duplex */ - if ((adapter->hw.media_type == e1000_media_type_fiber) && + if ((adapter->hw.phy.media_type == e1000_media_type_fiber) && spddplx != (SPEED_1000 + DUPLEX_FULL)) { ndev_err(adapter->netdev, "Unsupported Speed/Duplex " "configuration\n"); @@ -241,7 +241,7 @@ static int e1000_set_settings(struct net_device *netdev, if (ecmd->autoneg == AUTONEG_ENABLE) { hw->mac.autoneg = 1; - if (hw->media_type == e1000_media_type_fiber) + if (hw->phy.media_type == e1000_media_type_fiber) hw->phy.autoneg_advertised = ADVERTISED_1000baseT_Full | ADVERTISED_FIBRE | ADVERTISED_Autoneg; @@ -250,6 +250,8 @@ static int e1000_set_settings(struct net_device *netdev, ADVERTISED_TP | ADVERTISED_Autoneg; ecmd->advertising = hw->phy.autoneg_advertised; + if (adapter->fc_autoneg) + hw->fc.original_type = e1000_fc_default; } else { if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) { clear_bit(__E1000_RESETTING, &adapter->state); @@ -279,11 +281,11 @@ static void e1000_get_pauseparam(struct net_device *netdev, pause->autoneg = (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); - if (hw->mac.fc == e1000_fc_rx_pause) { + if (hw->fc.type == e1000_fc_rx_pause) { pause->rx_pause = 1; - } else if (hw->mac.fc == e1000_fc_tx_pause) { + } else if (hw->fc.type == e1000_fc_tx_pause) { pause->tx_pause = 1; - } else if (hw->mac.fc == e1000_fc_full) { + } else if (hw->fc.type == e1000_fc_full) { pause->rx_pause = 1; pause->tx_pause = 1; } @@ -302,18 +304,18 @@ static int e1000_set_pauseparam(struct net_device *netdev, msleep(1); if (pause->rx_pause && pause->tx_pause) - hw->mac.fc = e1000_fc_full; + hw->fc.type = e1000_fc_full; else if (pause->rx_pause && !pause->tx_pause) - hw->mac.fc = e1000_fc_rx_pause; + hw->fc.type = e1000_fc_rx_pause; else if (!pause->rx_pause && pause->tx_pause) - hw->mac.fc = e1000_fc_tx_pause; + hw->fc.type = e1000_fc_tx_pause; else if (!pause->rx_pause && !pause->tx_pause) - hw->mac.fc = e1000_fc_none; + hw->fc.type = e1000_fc_none; - hw->mac.original_fc = hw->mac.fc; + hw->fc.original_type = hw->fc.type; if (adapter->fc_autoneg == AUTONEG_ENABLE) { - hw->mac.fc = e1000_fc_default; + hw->fc.type = e1000_fc_default; if (netif_running(adapter->netdev)) { e1000e_down(adapter); e1000e_up(adapter); @@ -321,7 +323,7 @@ static int e1000_set_pauseparam(struct net_device *netdev, e1000e_reset(adapter); } } else { - retval = ((hw->media_type == e1000_media_type_fiber) ? + retval = ((hw->phy.media_type == e1000_media_type_fiber) ? hw->mac.ops.setup_link(hw) : e1000e_force_mac_fc(hw)); } @@ -1187,21 +1189,21 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) u32 ctrl_reg = 0; u32 stat_reg = 0; - adapter->hw.mac.autoneg = 0; + hw->mac.autoneg = 0; - if (adapter->hw.phy.type == e1000_phy_m88) { + if (hw->phy.type == e1000_phy_m88) { /* Auto-MDI/MDIX Off */ e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, 0x0808); /* reset to update Auto-MDI/MDIX */ e1e_wphy(hw, PHY_CONTROL, 0x9140); /* autoneg off */ e1e_wphy(hw, PHY_CONTROL, 0x8140); - } else if (adapter->hw.phy.type == e1000_phy_gg82563) + } else if (hw->phy.type == e1000_phy_gg82563) e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 0x1CC); ctrl_reg = er32(CTRL); - if (adapter->hw.phy.type == e1000_phy_ife) { + if (hw->phy.type == e1000_phy_ife) { /* force 100, set loopback */ e1e_wphy(hw, PHY_CONTROL, 0x6100); @@ -1224,8 +1226,8 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) E1000_CTRL_FD); /* Force Duplex to FULL */ } - if (adapter->hw.media_type == e1000_media_type_copper && - adapter->hw.phy.type == e1000_phy_m88) { + if (hw->phy.media_type == e1000_media_type_copper && + hw->phy.type == e1000_phy_m88) { ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ } else { /* @@ -1243,7 +1245,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) * Disable the receiver on the PHY so when a cable is plugged in, the * PHY does not begin to autoneg when a cable is reconnected to the NIC. */ - if (adapter->hw.phy.type == e1000_phy_m88) + if (hw->phy.type == e1000_phy_m88) e1000_phy_disable_receiver(adapter); udelay(500); @@ -1333,8 +1335,8 @@ static int e1000_setup_loopback_test(struct e1000_adapter *adapter) struct e1000_hw *hw = &adapter->hw; u32 rctl; - if (hw->media_type == e1000_media_type_fiber || - hw->media_type == e1000_media_type_internal_serdes) { + if (hw->phy.media_type == e1000_media_type_fiber || + hw->phy.media_type == e1000_media_type_internal_serdes) { switch (hw->mac.type) { case e1000_80003es2lan: return e1000_set_es2lan_mac_loopback(adapter); @@ -1349,7 +1351,7 @@ static int e1000_setup_loopback_test(struct e1000_adapter *adapter) ew32(RCTL, rctl); return 0; } - } else if (hw->media_type == e1000_media_type_copper) { + } else if (hw->phy.media_type == e1000_media_type_copper) { return e1000_integrated_phy_loopback(adapter); } @@ -1368,8 +1370,8 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter) switch (hw->mac.type) { case e1000_80003es2lan: - if (hw->media_type == e1000_media_type_fiber || - hw->media_type == e1000_media_type_internal_serdes) { + if (hw->phy.media_type == e1000_media_type_fiber || + hw->phy.media_type == e1000_media_type_internal_serdes) { /* restore CTRL_EXT, stealing space from tx_fifo_head */ ew32(CTRL_EXT, adapter->tx_fifo_head); adapter->tx_fifo_head = 0; @@ -1377,8 +1379,8 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter) /* fall through */ case e1000_82571: case e1000_82572: - if (hw->media_type == e1000_media_type_fiber || - hw->media_type == e1000_media_type_internal_serdes) { + if (hw->phy.media_type == e1000_media_type_fiber || + hw->phy.media_type == e1000_media_type_internal_serdes) { #define E1000_SERDES_LB_OFF 0x400 ew32(SCTL, E1000_SERDES_LB_OFF); msleep(10); @@ -1528,7 +1530,7 @@ static int e1000_link_test(struct e1000_adapter *adapter, u64 *data) struct e1000_hw *hw = &adapter->hw; *data = 0; - if (hw->media_type == e1000_media_type_internal_serdes) { + if (hw->phy.media_type == e1000_media_type_internal_serdes) { int i = 0; hw->mac.serdes_has_link = 0; @@ -1624,9 +1626,9 @@ static void e1000_diag_test(struct net_device *netdev, adapter->hw.mac.autoneg = autoneg; /* force this routine to wait until autoneg complete/timeout */ - adapter->hw.phy.wait_for_link = 1; + adapter->hw.phy.autoneg_wait_to_complete = 1; e1000e_reset(adapter); - adapter->hw.phy.wait_for_link = 0; + adapter->hw.phy.autoneg_wait_to_complete = 0; clear_bit(__E1000_TESTING, &adapter->state); if (if_running) -- cgit v1.2.3