diff options
author | Ayyappan Veeraiyan <ayyappan.veeraiyan@intel.com> | 2008-02-01 18:59:04 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-02-05 13:31:34 -0500 |
commit | 5eba3699a3b2e0d7afa0d4594980bafb1e47e2b4 (patch) | |
tree | d060086d594012abd408866f18bd0555ddf8a940 /drivers | |
parent | 9c83b070edd1f76531ba8a7a120e95f786dcbb73 (diff) |
ixgbe: Fix FW init/release, make this code a function
A gap was left in the FW release/grab code in up/down path. Fix
it by making the release/grab code a function and calling it in
appropriate locations.
Signed-off-by: Ayyappan Veeraiyan <ayyappan.veeraiyan@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index b4c9c77c09dd..c814d9bfbca7 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -87,6 +87,25 @@ MODULE_VERSION(DRV_VERSION); | |||
87 | 87 | ||
88 | #define DEFAULT_DEBUG_LEVEL_SHIFT 3 | 88 | #define DEFAULT_DEBUG_LEVEL_SHIFT 3 |
89 | 89 | ||
90 | static void ixgbe_release_hw_control(struct ixgbe_adapter *adapter) | ||
91 | { | ||
92 | u32 ctrl_ext; | ||
93 | |||
94 | /* Let firmware take over control of h/w */ | ||
95 | ctrl_ext = IXGBE_READ_REG(&adapter->hw, IXGBE_CTRL_EXT); | ||
96 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_CTRL_EXT, | ||
97 | ctrl_ext & ~IXGBE_CTRL_EXT_DRV_LOAD); | ||
98 | } | ||
99 | |||
100 | static void ixgbe_get_hw_control(struct ixgbe_adapter *adapter) | ||
101 | { | ||
102 | u32 ctrl_ext; | ||
103 | |||
104 | /* Let firmware know the driver has taken over */ | ||
105 | ctrl_ext = IXGBE_READ_REG(&adapter->hw, IXGBE_CTRL_EXT); | ||
106 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_CTRL_EXT, | ||
107 | ctrl_ext | IXGBE_CTRL_EXT_DRV_LOAD); | ||
108 | } | ||
90 | 109 | ||
91 | #ifdef DEBUG | 110 | #ifdef DEBUG |
92 | /** | 111 | /** |
@@ -1204,6 +1223,8 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter) | |||
1204 | u32 txdctl, rxdctl, mhadd; | 1223 | u32 txdctl, rxdctl, mhadd; |
1205 | int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; | 1224 | int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; |
1206 | 1225 | ||
1226 | ixgbe_get_hw_control(adapter); | ||
1227 | |||
1207 | if (adapter->flags & (IXGBE_FLAG_MSIX_ENABLED | | 1228 | if (adapter->flags & (IXGBE_FLAG_MSIX_ENABLED | |
1208 | IXGBE_FLAG_MSI_ENABLED)) { | 1229 | IXGBE_FLAG_MSI_ENABLED)) { |
1209 | if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { | 1230 | if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { |
@@ -1490,6 +1511,8 @@ static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1490 | pci_enable_wake(pdev, PCI_D3hot, 0); | 1511 | pci_enable_wake(pdev, PCI_D3hot, 0); |
1491 | pci_enable_wake(pdev, PCI_D3cold, 0); | 1512 | pci_enable_wake(pdev, PCI_D3cold, 0); |
1492 | 1513 | ||
1514 | ixgbe_release_hw_control(adapter); | ||
1515 | |||
1493 | pci_disable_device(pdev); | 1516 | pci_disable_device(pdev); |
1494 | 1517 | ||
1495 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 1518 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
@@ -1891,14 +1914,8 @@ static int ixgbe_open(struct net_device *netdev) | |||
1891 | { | 1914 | { |
1892 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 1915 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
1893 | int err; | 1916 | int err; |
1894 | u32 ctrl_ext; | ||
1895 | u32 num_rx_queues = adapter->num_rx_queues; | 1917 | u32 num_rx_queues = adapter->num_rx_queues; |
1896 | 1918 | ||
1897 | /* Let firmware know the driver has taken over */ | ||
1898 | ctrl_ext = IXGBE_READ_REG(&adapter->hw, IXGBE_CTRL_EXT); | ||
1899 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_CTRL_EXT, | ||
1900 | ctrl_ext | IXGBE_CTRL_EXT_DRV_LOAD); | ||
1901 | |||
1902 | try_intr_reinit: | 1919 | try_intr_reinit: |
1903 | /* allocate transmit descriptors */ | 1920 | /* allocate transmit descriptors */ |
1904 | err = ixgbe_setup_all_tx_resources(adapter); | 1921 | err = ixgbe_setup_all_tx_resources(adapter); |
@@ -1949,6 +1966,7 @@ try_intr_reinit: | |||
1949 | return 0; | 1966 | return 0; |
1950 | 1967 | ||
1951 | err_up: | 1968 | err_up: |
1969 | ixgbe_release_hw_control(adapter); | ||
1952 | ixgbe_free_irq(adapter); | 1970 | ixgbe_free_irq(adapter); |
1953 | err_req_irq: | 1971 | err_req_irq: |
1954 | ixgbe_free_all_rx_resources(adapter); | 1972 | ixgbe_free_all_rx_resources(adapter); |
@@ -1974,7 +1992,6 @@ err_setup_tx: | |||
1974 | static int ixgbe_close(struct net_device *netdev) | 1992 | static int ixgbe_close(struct net_device *netdev) |
1975 | { | 1993 | { |
1976 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 1994 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
1977 | u32 ctrl_ext; | ||
1978 | 1995 | ||
1979 | ixgbe_down(adapter); | 1996 | ixgbe_down(adapter); |
1980 | ixgbe_free_irq(adapter); | 1997 | ixgbe_free_irq(adapter); |
@@ -1982,9 +1999,7 @@ static int ixgbe_close(struct net_device *netdev) | |||
1982 | ixgbe_free_all_tx_resources(adapter); | 1999 | ixgbe_free_all_tx_resources(adapter); |
1983 | ixgbe_free_all_rx_resources(adapter); | 2000 | ixgbe_free_all_rx_resources(adapter); |
1984 | 2001 | ||
1985 | ctrl_ext = IXGBE_READ_REG(&adapter->hw, IXGBE_CTRL_EXT); | 2002 | ixgbe_release_hw_control(adapter); |
1986 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_CTRL_EXT, | ||
1987 | ctrl_ext & ~IXGBE_CTRL_EXT_DRV_LOAD); | ||
1988 | 2003 | ||
1989 | return 0; | 2004 | return 0; |
1990 | } | 2005 | } |
@@ -2749,6 +2764,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
2749 | return 0; | 2764 | return 0; |
2750 | 2765 | ||
2751 | err_register: | 2766 | err_register: |
2767 | ixgbe_release_hw_control(adapter); | ||
2752 | err_hw_init: | 2768 | err_hw_init: |
2753 | err_sw_init: | 2769 | err_sw_init: |
2754 | err_eeprom: | 2770 | err_eeprom: |
@@ -2784,6 +2800,8 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) | |||
2784 | 2800 | ||
2785 | unregister_netdev(netdev); | 2801 | unregister_netdev(netdev); |
2786 | 2802 | ||
2803 | ixgbe_release_hw_control(adapter); | ||
2804 | |||
2787 | kfree(adapter->tx_ring); | 2805 | kfree(adapter->tx_ring); |
2788 | kfree(adapter->rx_ring); | 2806 | kfree(adapter->rx_ring); |
2789 | 2807 | ||