diff options
author | xunleer <xunleer.li@huawei.com> | 2013-03-05 02:44:20 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2013-03-26 05:31:48 -0400 |
commit | a1f6c6b147cc5e83ec36dab8370bd5ec5fa1def6 (patch) | |
tree | 5280251d7b50fa2645d05796d801561da27f498e /drivers/net | |
parent | a79ca223e029aa4f09abb337accf1812c900a800 (diff) |
ixgbevf: don't release the soft entries
When the ixgbevf driver is opened the request to allocate MSIX irq
vectors may fail. In that case the driver will call ixgbevf_down()
which will call ixgbevf_irq_disable() to clear the HW interrupt
registers and calls synchronize_irq() using the msix_entries pointer in
the adapter structure. However, when the function to request the MSIX
irq vectors failed it had already freed the msix_entries which causes
an OOPs from using the NULL pointer in synchronize_irq().
The calls to pci_disable_msix() and to free the msix_entries memory
should not occur if device open fails. Instead they should be called
during device driver removal to balance with the call to
pci_enable_msix() and the call to allocate msix_entries memory
during the device probe and driver load.
Signed-off-by: Li Xun <xunleer.li@huawei.com>
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index c3db6cd69b68..2b6cb5ca48ee 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -944,9 +944,17 @@ free_queue_irqs: | |||
944 | free_irq(adapter->msix_entries[vector].vector, | 944 | free_irq(adapter->msix_entries[vector].vector, |
945 | adapter->q_vector[vector]); | 945 | adapter->q_vector[vector]); |
946 | } | 946 | } |
947 | pci_disable_msix(adapter->pdev); | 947 | /* This failure is non-recoverable - it indicates the system is |
948 | kfree(adapter->msix_entries); | 948 | * out of MSIX vector resources and the VF driver cannot run |
949 | adapter->msix_entries = NULL; | 949 | * without them. Set the number of msix vectors to zero |
950 | * indicating that not enough can be allocated. The error | ||
951 | * will be returned to the user indicating device open failed. | ||
952 | * Any further attempts to force the driver to open will also | ||
953 | * fail. The only way to recover is to unload the driver and | ||
954 | * reload it again. If the system has recovered some MSIX | ||
955 | * vectors then it may succeed. | ||
956 | */ | ||
957 | adapter->num_msix_vectors = 0; | ||
950 | return err; | 958 | return err; |
951 | } | 959 | } |
952 | 960 | ||
@@ -2572,6 +2580,15 @@ static int ixgbevf_open(struct net_device *netdev) | |||
2572 | struct ixgbe_hw *hw = &adapter->hw; | 2580 | struct ixgbe_hw *hw = &adapter->hw; |
2573 | int err; | 2581 | int err; |
2574 | 2582 | ||
2583 | /* A previous failure to open the device because of a lack of | ||
2584 | * available MSIX vector resources may have reset the number | ||
2585 | * of msix vectors variable to zero. The only way to recover | ||
2586 | * is to unload/reload the driver and hope that the system has | ||
2587 | * been able to recover some MSIX vector resources. | ||
2588 | */ | ||
2589 | if (!adapter->num_msix_vectors) | ||
2590 | return -ENOMEM; | ||
2591 | |||
2575 | /* disallow open during test */ | 2592 | /* disallow open during test */ |
2576 | if (test_bit(__IXGBEVF_TESTING, &adapter->state)) | 2593 | if (test_bit(__IXGBEVF_TESTING, &adapter->state)) |
2577 | return -EBUSY; | 2594 | return -EBUSY; |
@@ -2628,7 +2645,6 @@ static int ixgbevf_open(struct net_device *netdev) | |||
2628 | 2645 | ||
2629 | err_req_irq: | 2646 | err_req_irq: |
2630 | ixgbevf_down(adapter); | 2647 | ixgbevf_down(adapter); |
2631 | ixgbevf_free_irq(adapter); | ||
2632 | err_setup_rx: | 2648 | err_setup_rx: |
2633 | ixgbevf_free_all_rx_resources(adapter); | 2649 | ixgbevf_free_all_rx_resources(adapter); |
2634 | err_setup_tx: | 2650 | err_setup_tx: |