pasemi_mac: Abstract and fix up interrupt restart routines
Abstract out (and fix up) the interrupt restart routines, making sure we start out in a consistent state. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
committed by
Jeff Garzik
parent
771f7404a9
commit
1b0335ea30
@@ -362,6 +362,42 @@ static void pasemi_mac_replenish_rx_ring(struct net_device *dev)
|
|||||||
mac->rx->next_to_fill += count;
|
mac->rx->next_to_fill += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac)
|
||||||
|
{
|
||||||
|
unsigned int reg, stat;
|
||||||
|
/* Re-enable packet count interrupts: finally
|
||||||
|
* ack the packet count interrupt we got in rx_intr.
|
||||||
|
*/
|
||||||
|
|
||||||
|
pci_read_config_dword(mac->iob_pdev,
|
||||||
|
PAS_IOB_DMA_RXCH_STAT(mac->dma_rxch),
|
||||||
|
&stat);
|
||||||
|
|
||||||
|
reg = PAS_IOB_DMA_RXCH_RESET_PCNT(stat & PAS_IOB_DMA_RXCH_STAT_CNTDEL_M)
|
||||||
|
| PAS_IOB_DMA_RXCH_RESET_PINTC;
|
||||||
|
|
||||||
|
pci_write_config_dword(mac->iob_pdev,
|
||||||
|
PAS_IOB_DMA_RXCH_RESET(mac->dma_rxch),
|
||||||
|
reg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void pasemi_mac_restart_tx_intr(struct pasemi_mac *mac)
|
||||||
|
{
|
||||||
|
unsigned int reg, stat;
|
||||||
|
|
||||||
|
/* Re-enable packet count interrupts */
|
||||||
|
pci_read_config_dword(mac->iob_pdev,
|
||||||
|
PAS_IOB_DMA_TXCH_STAT(mac->dma_txch), &stat);
|
||||||
|
|
||||||
|
reg = PAS_IOB_DMA_TXCH_RESET_PCNT(stat & PAS_IOB_DMA_TXCH_STAT_CNTDEL_M)
|
||||||
|
| PAS_IOB_DMA_TXCH_RESET_PINTC;
|
||||||
|
|
||||||
|
pci_write_config_dword(mac->iob_pdev,
|
||||||
|
PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), reg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit)
|
static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@@ -559,6 +595,10 @@ static int pasemi_mac_open(struct net_device *dev)
|
|||||||
pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_RXCH_CFG(mac->dma_rxch),
|
pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_RXCH_CFG(mac->dma_rxch),
|
||||||
PAS_IOB_DMA_RXCH_CFG_CNTTH(30));
|
PAS_IOB_DMA_RXCH_CFG_CNTTH(30));
|
||||||
|
|
||||||
|
/* Clear out any residual packet count state from firmware */
|
||||||
|
pasemi_mac_restart_rx_intr(mac);
|
||||||
|
pasemi_mac_restart_tx_intr(mac);
|
||||||
|
|
||||||
pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_COM_TIMEOUTCFG,
|
pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_COM_TIMEOUTCFG,
|
||||||
PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(1000000));
|
PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(1000000));
|
||||||
|
|
||||||
@@ -835,9 +875,7 @@ static int pasemi_mac_poll(struct net_device *dev, int *budget)
|
|||||||
/* all done, no more packets present */
|
/* all done, no more packets present */
|
||||||
netif_rx_complete(dev);
|
netif_rx_complete(dev);
|
||||||
|
|
||||||
/* re-enable receive interrupts */
|
pasemi_mac_restart_rx_intr(mac);
|
||||||
pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_COM_TIMEOUTCFG,
|
|
||||||
PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(1000000));
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
/* used up our quantum, so reschedule */
|
/* used up our quantum, so reschedule */
|
||||||
|
Reference in New Issue
Block a user