forked from Minki/linux
pasemi_mac: A couple of minor bugfixes.
Bugfixes: * Move the wake_queue logic from tx_intr to clean_tx * Always do wake_queue even if queue wasn't full before clean since it's safe to do * Fix polarity in checks in pasemi_mac_close Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
parent
5b94f675f5
commit
0ce68c7416
@ -476,6 +476,8 @@ static int pasemi_mac_clean_tx(struct pasemi_mac *mac)
|
|||||||
mac->tx->next_to_clean += count;
|
mac->tx->next_to_clean += count;
|
||||||
spin_unlock_irqrestore(&mac->tx->lock, flags);
|
spin_unlock_irqrestore(&mac->tx->lock, flags);
|
||||||
|
|
||||||
|
netif_wake_queue(mac->netdev);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,9 +512,6 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data)
|
|||||||
struct net_device *dev = data;
|
struct net_device *dev = data;
|
||||||
struct pasemi_mac *mac = netdev_priv(dev);
|
struct pasemi_mac *mac = netdev_priv(dev);
|
||||||
unsigned int reg;
|
unsigned int reg;
|
||||||
int was_full;
|
|
||||||
|
|
||||||
was_full = mac->tx->next_to_clean - mac->tx->next_to_use == TX_RING_SIZE;
|
|
||||||
|
|
||||||
if (!(*mac->tx_status & PAS_STATUS_INT))
|
if (!(*mac->tx_status & PAS_STATUS_INT))
|
||||||
return IRQ_NONE;
|
return IRQ_NONE;
|
||||||
@ -526,9 +525,6 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data)
|
|||||||
pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_RESET(mac->dma_txch),
|
pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_RESET(mac->dma_txch),
|
||||||
reg);
|
reg);
|
||||||
|
|
||||||
if (was_full)
|
|
||||||
netif_wake_queue(dev);
|
|
||||||
|
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,40 +656,37 @@ static int pasemi_mac_close(struct net_device *dev)
|
|||||||
pci_read_config_dword(mac->dma_pdev,
|
pci_read_config_dword(mac->dma_pdev,
|
||||||
PAS_DMA_TXCHAN_TCMDSTA(mac->dma_txch),
|
PAS_DMA_TXCHAN_TCMDSTA(mac->dma_txch),
|
||||||
&stat);
|
&stat);
|
||||||
if (stat & PAS_DMA_TXCHAN_TCMDSTA_ACT)
|
if (!(stat & PAS_DMA_TXCHAN_TCMDSTA_ACT))
|
||||||
break;
|
break;
|
||||||
cond_resched();
|
cond_resched();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(stat & PAS_DMA_TXCHAN_TCMDSTA_ACT)) {
|
if (stat & PAS_DMA_TXCHAN_TCMDSTA_ACT)
|
||||||
dev_err(&mac->dma_pdev->dev, "Failed to stop tx channel\n");
|
dev_err(&mac->dma_pdev->dev, "Failed to stop tx channel\n");
|
||||||
}
|
|
||||||
|
|
||||||
for (retries = 0; retries < MAX_RETRIES; retries++) {
|
for (retries = 0; retries < MAX_RETRIES; retries++) {
|
||||||
pci_read_config_dword(mac->dma_pdev,
|
pci_read_config_dword(mac->dma_pdev,
|
||||||
PAS_DMA_RXCHAN_CCMDSTA(mac->dma_rxch),
|
PAS_DMA_RXCHAN_CCMDSTA(mac->dma_rxch),
|
||||||
&stat);
|
&stat);
|
||||||
if (stat & PAS_DMA_RXCHAN_CCMDSTA_ACT)
|
if (!(stat & PAS_DMA_RXCHAN_CCMDSTA_ACT))
|
||||||
break;
|
break;
|
||||||
cond_resched();
|
cond_resched();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(stat & PAS_DMA_RXCHAN_CCMDSTA_ACT)) {
|
if (stat & PAS_DMA_RXCHAN_CCMDSTA_ACT)
|
||||||
dev_err(&mac->dma_pdev->dev, "Failed to stop rx channel\n");
|
dev_err(&mac->dma_pdev->dev, "Failed to stop rx channel\n");
|
||||||
}
|
|
||||||
|
|
||||||
for (retries = 0; retries < MAX_RETRIES; retries++) {
|
for (retries = 0; retries < MAX_RETRIES; retries++) {
|
||||||
pci_read_config_dword(mac->dma_pdev,
|
pci_read_config_dword(mac->dma_pdev,
|
||||||
PAS_DMA_RXINT_RCMDSTA(mac->dma_if),
|
PAS_DMA_RXINT_RCMDSTA(mac->dma_if),
|
||||||
&stat);
|
&stat);
|
||||||
if (stat & PAS_DMA_RXINT_RCMDSTA_ACT)
|
if (!(stat & PAS_DMA_RXINT_RCMDSTA_ACT))
|
||||||
break;
|
break;
|
||||||
cond_resched();
|
cond_resched();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(stat & PAS_DMA_RXINT_RCMDSTA_ACT)) {
|
if (stat & PAS_DMA_RXINT_RCMDSTA_ACT)
|
||||||
dev_err(&mac->dma_pdev->dev, "Failed to stop rx interface\n");
|
dev_err(&mac->dma_pdev->dev, "Failed to stop rx interface\n");
|
||||||
}
|
|
||||||
|
|
||||||
/* Then, disable the channel. This must be done separately from
|
/* Then, disable the channel. This must be done separately from
|
||||||
* stopping, since you can't disable when active.
|
* stopping, since you can't disable when active.
|
||||||
|
Loading…
Reference in New Issue
Block a user