Commit fb136c07 authored by Auke Kok's avatar Auke Kok Committed by Jeff Garzik

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
Signed-off-by: default avatarAuke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 4a79a04e
...@@ -193,8 +193,6 @@ struct ixgb_adapter { ...@@ -193,8 +193,6 @@ struct ixgb_adapter {
u16 msg_enable; u16 msg_enable;
struct ixgb_hw_stats stats; struct ixgb_hw_stats stats;
uint32_t alloc_rx_buff_failed; uint32_t alloc_rx_buff_failed;
#ifdef CONFIG_PCI_MSI
boolean_t have_msi; boolean_t have_msi;
#endif
}; };
#endif /* _IXGB_H_ */ #endif /* _IXGB_H_ */
...@@ -227,7 +227,7 @@ int ...@@ -227,7 +227,7 @@ int
ixgb_up(struct ixgb_adapter *adapter) ixgb_up(struct ixgb_adapter *adapter)
{ {
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
int err; int err, irq_flags = IRQF_SHARED;
int max_frame = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH; int max_frame = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH;
struct ixgb_hw *hw = &adapter->hw; struct ixgb_hw *hw = &adapter->hw;
...@@ -246,26 +246,21 @@ ixgb_up(struct ixgb_adapter *adapter) ...@@ -246,26 +246,21 @@ ixgb_up(struct ixgb_adapter *adapter)
/* disable interrupts and get the hardware into a known state */ /* disable interrupts and get the hardware into a known state */
IXGB_WRITE_REG(&adapter->hw, IMC, 0xffffffff); IXGB_WRITE_REG(&adapter->hw, IMC, 0xffffffff);
#ifdef CONFIG_PCI_MSI /* only enable MSI if bus is in PCI-X mode */
{ if (IXGB_READ_REG(&adapter->hw, STATUS) & IXGB_STATUS_PCIX_MODE) {
boolean_t pcix = (IXGB_READ_REG(&adapter->hw, STATUS) & err = pci_enable_msi(adapter->pdev);
IXGB_STATUS_PCIX_MODE) ? TRUE : FALSE; if (!err) {
adapter->have_msi = TRUE; adapter->have_msi = 1;
irq_flags = 0;
if (!pcix)
adapter->have_msi = FALSE;
else if((err = pci_enable_msi(adapter->pdev))) {
DPRINTK(PROBE, ERR,
"Unable to allocate MSI interrupt Error: %d\n", err);
adapter->have_msi = FALSE;
/* proceed to try to request regular interrupt */
} }
/* proceed to try to request regular interrupt */
} }
#endif err = request_irq(adapter->pdev->irq, &ixgb_intr, irq_flags,
if((err = request_irq(adapter->pdev->irq, &ixgb_intr, netdev->name, netdev);
IRQF_SHARED | IRQF_SAMPLE_RANDOM, if (err) {
netdev->name, netdev))) { if (adapter->have_msi)
pci_disable_msi(adapter->pdev);
DPRINTK(PROBE, ERR, DPRINTK(PROBE, ERR,
"Unable to allocate interrupt Error: %d\n", err); "Unable to allocate interrupt Error: %d\n", err);
return err; return err;
...@@ -307,11 +302,10 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog) ...@@ -307,11 +302,10 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
ixgb_irq_disable(adapter); ixgb_irq_disable(adapter);
free_irq(adapter->pdev->irq, netdev); free_irq(adapter->pdev->irq, netdev);
#ifdef CONFIG_PCI_MSI
if(adapter->have_msi == TRUE) if (adapter->have_msi)
pci_disable_msi(adapter->pdev); pci_disable_msi(adapter->pdev);
#endif
if(kill_watchdog) if(kill_watchdog)
del_timer_sync(&adapter->watchdog_timer); del_timer_sync(&adapter->watchdog_timer);
#ifdef CONFIG_IXGB_NAPI #ifdef CONFIG_IXGB_NAPI
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment