aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2007-05-12 19:01:09 -0400
committerJeff Garzik <jeff@garzik.org>2007-05-15 17:44:39 -0400
commit52a9435183f961e1bb3c146a62bfbecf93d15d58 (patch)
tree6e38b92dbf4b2667cbad7b5930b249fd0ed2f94c /drivers
parenta54c545134ea77609ed9eb5df50524c097112327 (diff)
pasemi_mac: Interrupt ack fixes
Interrupt ack fixes Fix the packet count resets at interrupt time, using the cacheable packet count status to set number of processed/received packets, since the ack count is the cumulative number of packets processed, and not incremental. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/pasemi_mac.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index bc7f3dee6e5b..39e33aeca11a 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -384,17 +384,14 @@ static void pasemi_mac_replenish_rx_ring(struct net_device *dev)
384 384
385static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac) 385static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac)
386{ 386{
387 unsigned int reg, stat; 387 unsigned int reg, pcnt;
388 /* Re-enable packet count interrupts: finally 388 /* Re-enable packet count interrupts: finally
389 * ack the packet count interrupt we got in rx_intr. 389 * ack the packet count interrupt we got in rx_intr.
390 */ 390 */
391 391
392 pci_read_config_dword(mac->iob_pdev, 392 pcnt = *mac->rx_status & PAS_STATUS_PCNT_M;
393 PAS_IOB_DMA_RXCH_STAT(mac->dma_rxch),
394 &stat);
395 393
396 reg = PAS_IOB_DMA_RXCH_RESET_PCNT(stat & PAS_IOB_DMA_RXCH_STAT_CNTDEL_M) 394 reg = PAS_IOB_DMA_RXCH_RESET_PCNT(pcnt) | PAS_IOB_DMA_RXCH_RESET_PINTC;
397 | PAS_IOB_DMA_RXCH_RESET_PINTC;
398 395
399 pci_write_config_dword(mac->iob_pdev, 396 pci_write_config_dword(mac->iob_pdev,
400 PAS_IOB_DMA_RXCH_RESET(mac->dma_rxch), 397 PAS_IOB_DMA_RXCH_RESET(mac->dma_rxch),
@@ -403,14 +400,12 @@ static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac)
403 400
404static void pasemi_mac_restart_tx_intr(struct pasemi_mac *mac) 401static void pasemi_mac_restart_tx_intr(struct pasemi_mac *mac)
405{ 402{
406 unsigned int reg, stat; 403 unsigned int reg, pcnt;
407 404
408 /* Re-enable packet count interrupts */ 405 /* Re-enable packet count interrupts */
409 pci_read_config_dword(mac->iob_pdev, 406 pcnt = *mac->tx_status & PAS_STATUS_PCNT_M;
410 PAS_IOB_DMA_TXCH_STAT(mac->dma_txch), &stat);
411 407
412 reg = PAS_IOB_DMA_TXCH_RESET_PCNT(stat & PAS_IOB_DMA_TXCH_STAT_CNTDEL_M) 408 reg = PAS_IOB_DMA_TXCH_RESET_PCNT(pcnt) | PAS_IOB_DMA_TXCH_RESET_PINTC;
413 | PAS_IOB_DMA_TXCH_RESET_PINTC;
414 409
415 pci_write_config_dword(mac->iob_pdev, 410 pci_write_config_dword(mac->iob_pdev,
416 PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), reg); 411 PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), reg);
@@ -591,21 +586,24 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data)
591{ 586{
592 struct net_device *dev = data; 587 struct net_device *dev = data;
593 struct pasemi_mac *mac = netdev_priv(dev); 588 struct pasemi_mac *mac = netdev_priv(dev);
594 unsigned int reg; 589 unsigned int reg, pcnt;
595 590
596 if (!(*mac->tx_status & PAS_STATUS_CAUSE_M)) 591 if (!(*mac->tx_status & PAS_STATUS_CAUSE_M))
597 return IRQ_NONE; 592 return IRQ_NONE;
598 593
599 pasemi_mac_clean_tx(mac); 594 pasemi_mac_clean_tx(mac);
600 595
601 reg = PAS_IOB_DMA_TXCH_RESET_PINTC; 596 pcnt = *mac->tx_status & PAS_STATUS_PCNT_M;
597
598 reg = PAS_IOB_DMA_TXCH_RESET_PCNT(pcnt) | PAS_IOB_DMA_TXCH_RESET_PINTC;
602 599
603 if (*mac->tx_status & PAS_STATUS_SOFT) 600 if (*mac->tx_status & PAS_STATUS_SOFT)
604 reg |= PAS_IOB_DMA_TXCH_RESET_SINTC; 601 reg |= PAS_IOB_DMA_TXCH_RESET_SINTC;
605 if (*mac->tx_status & PAS_STATUS_ERROR) 602 if (*mac->tx_status & PAS_STATUS_ERROR)
606 reg |= PAS_IOB_DMA_TXCH_RESET_DINTC; 603 reg |= PAS_IOB_DMA_TXCH_RESET_DINTC;
607 604
608 pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), 605 pci_write_config_dword(mac->iob_pdev,
606 PAS_IOB_DMA_TXCH_RESET(mac->dma_txch),
609 reg); 607 reg);
610 608
611 return IRQ_HANDLED; 609 return IRQ_HANDLED;
@@ -974,6 +972,7 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
974 if (txring->next_to_clean - txring->next_to_use == TX_RING_SIZE) { 972 if (txring->next_to_clean - txring->next_to_use == TX_RING_SIZE) {
975 spin_unlock_irqrestore(&txring->lock, flags); 973 spin_unlock_irqrestore(&txring->lock, flags);
976 pasemi_mac_clean_tx(mac); 974 pasemi_mac_clean_tx(mac);
975 pasemi_mac_restart_tx_intr(mac);
977 spin_lock_irqsave(&txring->lock, flags); 976 spin_lock_irqsave(&txring->lock, flags);
978 977
979 if (txring->next_to_clean - txring->next_to_use == 978 if (txring->next_to_clean - txring->next_to_use ==