aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c77
1 files changed, 37 insertions, 40 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index dceae37fd57f..850361a4c38d 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -1954,11 +1954,43 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter)
1954 (adapter->rx_ring[i].count - 1)); 1954 (adapter->rx_ring[i].count - 1));
1955} 1955}
1956 1956
1957/**
1958 * ixgbe_link_config - set up initial link with default speed and duplex
1959 * @hw: pointer to private hardware struct
1960 *
1961 * Returns 0 on success, negative on failure
1962 **/
1963static int ixgbe_link_config(struct ixgbe_hw *hw)
1964{
1965 u32 autoneg;
1966 bool link_up = false;
1967 u32 ret = IXGBE_ERR_LINK_SETUP;
1968
1969 if (hw->mac.ops.check_link)
1970 ret = hw->mac.ops.check_link(hw, &autoneg, &link_up, false);
1971
1972 if (ret)
1973 goto link_cfg_out;
1974
1975 if (hw->mac.ops.get_link_capabilities)
1976 ret = hw->mac.ops.get_link_capabilities(hw, &autoneg,
1977 &hw->mac.autoneg);
1978 if (ret)
1979 goto link_cfg_out;
1980
1981 if (hw->mac.ops.setup_link_speed)
1982 ret = hw->mac.ops.setup_link_speed(hw, autoneg, true, link_up);
1983
1984link_cfg_out:
1985 return ret;
1986}
1987
1957static int ixgbe_up_complete(struct ixgbe_adapter *adapter) 1988static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
1958{ 1989{
1959 struct net_device *netdev = adapter->netdev; 1990 struct net_device *netdev = adapter->netdev;
1960 struct ixgbe_hw *hw = &adapter->hw; 1991 struct ixgbe_hw *hw = &adapter->hw;
1961 int i, j = 0; 1992 int i, j = 0;
1993 int err;
1962 int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; 1994 int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
1963 u32 txdctl, rxdctl, mhadd; 1995 u32 txdctl, rxdctl, mhadd;
1964 u32 gpie; 1996 u32 gpie;
@@ -2039,6 +2071,10 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
2039 2071
2040 ixgbe_irq_enable(adapter); 2072 ixgbe_irq_enable(adapter);
2041 2073
2074 err = ixgbe_link_config(hw);
2075 if (err)
2076 dev_err(&adapter->pdev->dev, "link_config FAILED %d\n", err);
2077
2042 /* enable transmits */ 2078 /* enable transmits */
2043 netif_tx_start_all_queues(netdev); 2079 netif_tx_start_all_queues(netdev);
2044 2080
@@ -2792,8 +2828,7 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
2792 adapter->flags |= IXGBE_FLAG_FAN_FAIL_CAPABLE; 2828 adapter->flags |= IXGBE_FLAG_FAN_FAIL_CAPABLE;
2793 2829
2794 /* default flow control settings */ 2830 /* default flow control settings */
2795 hw->fc.original_type = ixgbe_fc_none; 2831 hw->fc.requested_mode = ixgbe_fc_none;
2796 hw->fc.type = ixgbe_fc_none;
2797 hw->fc.high_water = IXGBE_DEFAULT_FCRTH; 2832 hw->fc.high_water = IXGBE_DEFAULT_FCRTH;
2798 hw->fc.low_water = IXGBE_DEFAULT_FCRTL; 2833 hw->fc.low_water = IXGBE_DEFAULT_FCRTL;
2799 hw->fc.pause_time = IXGBE_DEFAULT_FCPAUSE; 2834 hw->fc.pause_time = IXGBE_DEFAULT_FCPAUSE;
@@ -3916,37 +3951,6 @@ static void ixgbe_netpoll(struct net_device *netdev)
3916} 3951}
3917#endif 3952#endif
3918 3953
3919/**
3920 * ixgbe_link_config - set up initial link with default speed and duplex
3921 * @hw: pointer to private hardware struct
3922 *
3923 * Returns 0 on success, negative on failure
3924 **/
3925static int ixgbe_link_config(struct ixgbe_hw *hw)
3926{
3927 u32 autoneg;
3928 bool link_up = false;
3929 u32 ret = IXGBE_ERR_LINK_SETUP;
3930
3931 if (hw->mac.ops.check_link)
3932 ret = hw->mac.ops.check_link(hw, &autoneg, &link_up, false);
3933
3934 if (ret || !link_up)
3935 goto link_cfg_out;
3936
3937 if (hw->mac.ops.get_link_capabilities)
3938 ret = hw->mac.ops.get_link_capabilities(hw, &autoneg,
3939 &hw->mac.autoneg);
3940 if (ret)
3941 goto link_cfg_out;
3942
3943 if (hw->mac.ops.setup_link_speed)
3944 ret = hw->mac.ops.setup_link_speed(hw, autoneg, true, true);
3945
3946link_cfg_out:
3947 return ret;
3948}
3949
3950static const struct net_device_ops ixgbe_netdev_ops = { 3954static const struct net_device_ops ixgbe_netdev_ops = {
3951 .ndo_open = ixgbe_open, 3955 .ndo_open = ixgbe_open,
3952 .ndo_stop = ixgbe_close, 3956 .ndo_stop = ixgbe_close,
@@ -4197,13 +4201,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
4197 /* reset the hardware with the new settings */ 4201 /* reset the hardware with the new settings */
4198 hw->mac.ops.start_hw(hw); 4202 hw->mac.ops.start_hw(hw);
4199 4203
4200 /* link_config depends on start_hw being called at least once */
4201 err = ixgbe_link_config(hw);
4202 if (err) {
4203 dev_err(&pdev->dev, "setup_link_speed FAILED %d\n", err);
4204 goto err_register;
4205 }
4206
4207 netif_carrier_off(netdev); 4204 netif_carrier_off(netdev);
4208 4205
4209 strcpy(netdev->name, "eth%d"); 4206 strcpy(netdev->name, "eth%d");