aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Tantilov <emil.s.tantilov@intel.com>2015-01-27 22:21:18 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2015-02-05 22:58:44 -0500
commitd9bdb57f9c9eee20835a947f2b9ece1ed2ef8485 (patch)
tree01cd7c22a8f8b0b752d036421c69eba203174f52
parent39f35a370b59d65506bbfb8f9c1b9362d58b44fe (diff)
ixgbevf: Fix ordering of shutdown to correctly disable Rx and Tx
This patch updates the ordering of the shutdown path so that we attempt to shutdown the rings more gracefully. Basically the big changes are that we shutdown the main Rx filter in the case of Rx and we set the carrier_off state in the case of Tx so that packets stop being delivered from outside the driver. Then we shut down interrupts and NAPI. Finally we stop the rings from performing DMA and clean them. This is a bit more graceful than the previous path. CC: Alexander Duyck <alexander.h.duyck@redhat.com> Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 6d24aa57ce3c..a4b3d66b39a0 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -1957,6 +1957,10 @@ static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter)
1957 clear_bit(__IXGBEVF_DOWN, &adapter->state); 1957 clear_bit(__IXGBEVF_DOWN, &adapter->state);
1958 ixgbevf_napi_enable_all(adapter); 1958 ixgbevf_napi_enable_all(adapter);
1959 1959
1960 /* clear any pending interrupts, may auto mask */
1961 IXGBE_READ_REG(hw, IXGBE_VTEICR);
1962 ixgbevf_irq_enable(adapter);
1963
1960 /* enable transmits */ 1964 /* enable transmits */
1961 netif_tx_start_all_queues(netdev); 1965 netif_tx_start_all_queues(netdev);
1962 1966
@@ -1969,16 +1973,9 @@ static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter)
1969 1973
1970void ixgbevf_up(struct ixgbevf_adapter *adapter) 1974void ixgbevf_up(struct ixgbevf_adapter *adapter)
1971{ 1975{
1972 struct ixgbe_hw *hw = &adapter->hw;
1973
1974 ixgbevf_configure(adapter); 1976 ixgbevf_configure(adapter);
1975 1977
1976 ixgbevf_up_complete(adapter); 1978 ixgbevf_up_complete(adapter);
1977
1978 /* clear any pending interrupts, may auto mask */
1979 IXGBE_READ_REG(hw, IXGBE_VTEICR);
1980
1981 ixgbevf_irq_enable(adapter);
1982} 1979}
1983 1980
1984/** 1981/**
@@ -2085,17 +2082,20 @@ void ixgbevf_down(struct ixgbevf_adapter *adapter)
2085 for (i = 0; i < adapter->num_rx_queues; i++) 2082 for (i = 0; i < adapter->num_rx_queues; i++)
2086 ixgbevf_disable_rx_queue(adapter, adapter->rx_ring[i]); 2083 ixgbevf_disable_rx_queue(adapter, adapter->rx_ring[i]);
2087 2084
2088 netif_tx_disable(netdev); 2085 usleep_range(10000, 20000);
2089
2090 msleep(10);
2091 2086
2092 netif_tx_stop_all_queues(netdev); 2087 netif_tx_stop_all_queues(netdev);
2093 2088
2089 /* call carrier off first to avoid false dev_watchdog timeouts */
2090 netif_carrier_off(netdev);
2091 netif_tx_disable(netdev);
2092
2094 ixgbevf_irq_disable(adapter); 2093 ixgbevf_irq_disable(adapter);
2095 2094
2096 ixgbevf_napi_disable_all(adapter); 2095 ixgbevf_napi_disable_all(adapter);
2097 2096
2098 del_timer_sync(&adapter->watchdog_timer); 2097 del_timer_sync(&adapter->watchdog_timer);
2098
2099 /* can't call flush scheduled work here because it can deadlock 2099 /* can't call flush scheduled work here because it can deadlock
2100 * if linkwatch_event tries to acquire the rtnl_lock which we are 2100 * if linkwatch_event tries to acquire the rtnl_lock which we are
2101 * holding */ 2101 * holding */
@@ -2110,8 +2110,6 @@ void ixgbevf_down(struct ixgbevf_adapter *adapter)
2110 IXGBE_TXDCTL_SWFLSH); 2110 IXGBE_TXDCTL_SWFLSH);
2111 } 2111 }
2112 2112
2113 netif_carrier_off(netdev);
2114
2115 if (!pci_channel_offline(adapter->pdev)) 2113 if (!pci_channel_offline(adapter->pdev))
2116 ixgbevf_reset(adapter); 2114 ixgbevf_reset(adapter);
2117 2115
@@ -2995,10 +2993,6 @@ static int ixgbevf_open(struct net_device *netdev)
2995 if (!adapter->num_msix_vectors) 2993 if (!adapter->num_msix_vectors)
2996 return -ENOMEM; 2994 return -ENOMEM;
2997 2995
2998 /* disallow open during test */
2999 if (test_bit(__IXGBEVF_TESTING, &adapter->state))
3000 return -EBUSY;
3001
3002 if (hw->adapter_stopped) { 2996 if (hw->adapter_stopped) {
3003 ixgbevf_reset(adapter); 2997 ixgbevf_reset(adapter);
3004 /* if adapter is still stopped then PF isn't up and 2998 /* if adapter is still stopped then PF isn't up and
@@ -3011,6 +3005,12 @@ static int ixgbevf_open(struct net_device *netdev)
3011 } 3005 }
3012 } 3006 }
3013 3007
3008 /* disallow open during test */
3009 if (test_bit(__IXGBEVF_TESTING, &adapter->state))
3010 return -EBUSY;
3011
3012 netif_carrier_off(netdev);
3013
3014 /* allocate transmit descriptors */ 3014 /* allocate transmit descriptors */
3015 err = ixgbevf_setup_all_tx_resources(adapter); 3015 err = ixgbevf_setup_all_tx_resources(adapter);
3016 if (err) 3016 if (err)
@@ -3030,15 +3030,11 @@ static int ixgbevf_open(struct net_device *netdev)
3030 */ 3030 */
3031 ixgbevf_map_rings_to_vectors(adapter); 3031 ixgbevf_map_rings_to_vectors(adapter);
3032 3032
3033 ixgbevf_up_complete(adapter);
3034
3035 /* clear any pending interrupts, may auto mask */
3036 IXGBE_READ_REG(hw, IXGBE_VTEICR);
3037 err = ixgbevf_request_irq(adapter); 3033 err = ixgbevf_request_irq(adapter);
3038 if (err) 3034 if (err)
3039 goto err_req_irq; 3035 goto err_req_irq;
3040 3036
3041 ixgbevf_irq_enable(adapter); 3037 ixgbevf_up_complete(adapter);
3042 3038
3043 return 0; 3039 return 0;
3044 3040