History

ixgb: don't print error if pci_enable_msi() fails, cleanup minor leak

pci_enable_msi calls can fail for normal operational reasons. Driver should not print an error message in that case. Fix a leak that leaves msi enabled if pci_request_irq fails. We can remove CONFIG_PCI_MSI ifdefs alltogether

Auke Kok committed 19 years ago

Commit fb136c01 parent 4a79a042 files · +15 −23Browse files

Unified · Split

2 files
  1. drivers/net/ixgb/ixgb.h +0 −2
  2. drivers/net/ixgb/ixgb_main.c +15 −21
drivers/net/ixgb/ixgb.h+0−2
@@ -193,8 +193,6 @@ struct ixgb_adapter { · 192 unmodified lines
193193 u16 msg_enable;
194194 struct ixgb_hw_stats stats;
195195 uint32_t alloc_rx_buff_failed;
196−#ifdef CONFIG_PCI_MSI
197196 boolean_t have_msi;
198−#endif
199197 };
200198 #endif /* _IXGB_H_ */
drivers/net/ixgb/ixgb_main.c+15−21
@@ -227,7 +227,7 @@ int · 226 unmodified lines
227227 ixgb_up(struct ixgb_adapter *adapter)
228228 {
229229 struct net_device *netdev = adapter->netdev;
230− int err;
230+ int err, irq_flags = IRQF_SHARED;
231231 int max_frame = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH;
232232 struct ixgb_hw *hw = &adapter->hw;
233233
@@ -246,26 +246,21 @@ ixgb_up(struct ixgb_adapter *adapter) · 12 unmodified lines
246246 /* disable interrupts and get the hardware into a known state */
247247 IXGB_WRITE_REG(&adapter->hw, IMC, 0xffffffff);
248248
249−#ifdef CONFIG_PCI_MSI
250− {
251− boolean_t pcix = (IXGB_READ_REG(&adapter->hw, STATUS) &
252− IXGB_STATUS_PCIX_MODE) ? TRUE : FALSE;
253− adapter->have_msi = TRUE;
254−
255− if (!pcix)
256− adapter->have_msi = FALSE;
257− else if((err = pci_enable_msi(adapter->pdev))) {
258− DPRINTK(PROBE, ERR,
259− "Unable to allocate MSI interrupt Error: %d\n", err);
260− adapter->have_msi = FALSE;
249+ /* only enable MSI if bus is in PCI-X mode */
250+ if (IXGB_READ_REG(&adapter->hw, STATUS) & IXGB_STATUS_PCIX_MODE) {
251+ err = pci_enable_msi(adapter->pdev);
252+ if (!err) {
253+ adapter->have_msi = 1;
254+ irq_flags = 0;
255+ }
261256 /* proceed to try to request regular interrupt */
262257 }
263− }
264258
265−#endif
266− if((err = request_irq(adapter->pdev->irq, &ixgb_intr,
267− IRQF_SHARED | IRQF_SAMPLE_RANDOM,
268− netdev->name, netdev))) {
259+ err = request_irq(adapter->pdev->irq, &ixgb_intr, irq_flags,
260+ netdev->name, netdev);
261+ if (err) {
262+ if (adapter->have_msi)
263+ pci_disable_msi(adapter->pdev);
269264 DPRINTK(PROBE, ERR,
270265 "Unable to allocate interrupt Error: %d\n", err);
271266 return err;
@@ -307,11 +302,10 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog) · 35 unmodified lines
307302
308303 ixgb_irq_disable(adapter);
309304 free_irq(adapter->pdev->irq, netdev);
310−#ifdef CONFIG_PCI_MSI
311− if(adapter->have_msi == TRUE)
305+
306+ if (adapter->have_msi)
312307 pci_disable_msi(adapter->pdev);
313308
314−#endif
315309 if(kill_watchdog)
316310 del_timer_sync(&adapter->watchdog_timer);
317311 #ifdef CONFIG_IXGB_NAPI

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t