diff options
author | Stefan Assmann <sassmann@kpanic.de> | 2012-12-04 01:00:12 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2012-12-07 00:45:59 -0500 |
commit | 53c7d06418bdf2f20fc869b33e3a44bb770aff1e (patch) | |
tree | dd2634954e3eb0e64324188cc55ae92bd64b6783 | |
parent | cb6d0f5eef58cfa1a78ebcfebd3d630c31061f79 (diff) |
igb: remove duplicate code for fallback interrupt initialization
Given a small change to igb_init_interrupt_scheme() the function fits
igb_request_irq() for MSI/legacy interrupts initialization as well, instead of
duplicating most of its code there.
Also adding a missing igb_configure() to igb_request_irq() for MSI fallback
to work properly.
Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_main.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index de4ebb306530..615b68c06505 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -122,6 +122,7 @@ static void igb_remove(struct pci_dev *pdev); | |||
122 | static int igb_sw_init(struct igb_adapter *); | 122 | static int igb_sw_init(struct igb_adapter *); |
123 | static int igb_open(struct net_device *); | 123 | static int igb_open(struct net_device *); |
124 | static int igb_close(struct net_device *); | 124 | static int igb_close(struct net_device *); |
125 | static void igb_configure(struct igb_adapter *); | ||
125 | static void igb_configure_tx(struct igb_adapter *); | 126 | static void igb_configure_tx(struct igb_adapter *); |
126 | static void igb_configure_rx(struct igb_adapter *); | 127 | static void igb_configure_rx(struct igb_adapter *); |
127 | static void igb_clean_all_tx_rings(struct igb_adapter *); | 128 | static void igb_clean_all_tx_rings(struct igb_adapter *); |
@@ -948,11 +949,14 @@ static void igb_clear_interrupt_scheme(struct igb_adapter *adapter) | |||
948 | * Attempt to configure interrupts using the best available | 949 | * Attempt to configure interrupts using the best available |
949 | * capabilities of the hardware and kernel. | 950 | * capabilities of the hardware and kernel. |
950 | **/ | 951 | **/ |
951 | static void igb_set_interrupt_capability(struct igb_adapter *adapter) | 952 | static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix) |
952 | { | 953 | { |
953 | int err; | 954 | int err; |
954 | int numvecs, i; | 955 | int numvecs, i; |
955 | 956 | ||
957 | if (!msix) | ||
958 | goto msi_only; | ||
959 | |||
956 | /* Number of supported queues. */ | 960 | /* Number of supported queues. */ |
957 | adapter->num_rx_queues = adapter->rss_queues; | 961 | adapter->num_rx_queues = adapter->rss_queues; |
958 | if (adapter->vfs_allocated_count) | 962 | if (adapter->vfs_allocated_count) |
@@ -1199,12 +1203,12 @@ err_out: | |||
1199 | * | 1203 | * |
1200 | * This function initializes the interrupts and allocates all of the queues. | 1204 | * This function initializes the interrupts and allocates all of the queues. |
1201 | **/ | 1205 | **/ |
1202 | static int igb_init_interrupt_scheme(struct igb_adapter *adapter) | 1206 | static int igb_init_interrupt_scheme(struct igb_adapter *adapter, bool msix) |
1203 | { | 1207 | { |
1204 | struct pci_dev *pdev = adapter->pdev; | 1208 | struct pci_dev *pdev = adapter->pdev; |
1205 | int err; | 1209 | int err; |
1206 | 1210 | ||
1207 | igb_set_interrupt_capability(adapter); | 1211 | igb_set_interrupt_capability(adapter, msix); |
1208 | 1212 | ||
1209 | err = igb_alloc_q_vectors(adapter); | 1213 | err = igb_alloc_q_vectors(adapter); |
1210 | if (err) { | 1214 | if (err) { |
@@ -1240,20 +1244,15 @@ static int igb_request_irq(struct igb_adapter *adapter) | |||
1240 | /* fall back to MSI */ | 1244 | /* fall back to MSI */ |
1241 | igb_free_all_tx_resources(adapter); | 1245 | igb_free_all_tx_resources(adapter); |
1242 | igb_free_all_rx_resources(adapter); | 1246 | igb_free_all_rx_resources(adapter); |
1247 | |||
1243 | igb_clear_interrupt_scheme(adapter); | 1248 | igb_clear_interrupt_scheme(adapter); |
1244 | if (!pci_enable_msi(pdev)) | 1249 | err = igb_init_interrupt_scheme(adapter, false); |
1245 | adapter->flags |= IGB_FLAG_HAS_MSI; | 1250 | if (err) |
1246 | adapter->num_tx_queues = 1; | ||
1247 | adapter->num_rx_queues = 1; | ||
1248 | adapter->num_q_vectors = 1; | ||
1249 | err = igb_alloc_q_vectors(adapter); | ||
1250 | if (err) { | ||
1251 | dev_err(&pdev->dev, | ||
1252 | "Unable to allocate memory for vectors\n"); | ||
1253 | goto request_done; | 1251 | goto request_done; |
1254 | } | 1252 | |
1255 | igb_setup_all_tx_resources(adapter); | 1253 | igb_setup_all_tx_resources(adapter); |
1256 | igb_setup_all_rx_resources(adapter); | 1254 | igb_setup_all_rx_resources(adapter); |
1255 | igb_configure(adapter); | ||
1257 | } | 1256 | } |
1258 | 1257 | ||
1259 | igb_assign_vector(adapter->q_vector[0], 0); | 1258 | igb_assign_vector(adapter->q_vector[0], 0); |
@@ -2444,7 +2443,7 @@ static int igb_sw_init(struct igb_adapter *adapter) | |||
2444 | GFP_ATOMIC); | 2443 | GFP_ATOMIC); |
2445 | 2444 | ||
2446 | /* This call may decrease the number of queues */ | 2445 | /* This call may decrease the number of queues */ |
2447 | if (igb_init_interrupt_scheme(adapter)) { | 2446 | if (igb_init_interrupt_scheme(adapter, true)) { |
2448 | dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); | 2447 | dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); |
2449 | return -ENOMEM; | 2448 | return -ENOMEM; |
2450 | } | 2449 | } |
@@ -6818,7 +6817,7 @@ static int igb_resume(struct device *dev) | |||
6818 | pci_enable_wake(pdev, PCI_D3hot, 0); | 6817 | pci_enable_wake(pdev, PCI_D3hot, 0); |
6819 | pci_enable_wake(pdev, PCI_D3cold, 0); | 6818 | pci_enable_wake(pdev, PCI_D3cold, 0); |
6820 | 6819 | ||
6821 | if (igb_init_interrupt_scheme(adapter)) { | 6820 | if (igb_init_interrupt_scheme(adapter, true)) { |
6822 | dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); | 6821 | dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); |
6823 | return -ENOMEM; | 6822 | return -ENOMEM; |
6824 | } | 6823 | } |