aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2007-04-28 16:36:40 -0400
committerJeff Garzik <jeff@garzik.org>2007-05-08 01:00:21 -0400
commit0ce68c74162ce288cfd214dd126b8d03b8b7a8ed (patch)
tree5882905aca8e2ba02a07d2631672d285bba5ee22 /drivers/net
parent5b94f675f57e4ff16c8fda09088d7480a84dcd91 (diff)
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/pasemi_mac.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 76fe9dd8e841..bde833542b6f 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -476,6 +476,8 @@ static int pasemi_mac_clean_tx(struct pasemi_mac *mac)
476 mac->tx->next_to_clean += count; 476 mac->tx->next_to_clean += count;
477 spin_unlock_irqrestore(&mac->tx->lock, flags); 477 spin_unlock_irqrestore(&mac->tx->lock, flags);
478 478
479 netif_wake_queue(mac->netdev);
480
479 return count; 481 return count;
480} 482}
481 483
@@ -510,9 +512,6 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data)
510 struct net_device *dev = data; 512 struct net_device *dev = data;
511 struct pasemi_mac *mac = netdev_priv(dev); 513 struct pasemi_mac *mac = netdev_priv(dev);
512 unsigned int reg; 514 unsigned int reg;
513 int was_full;
514
515 was_full = mac->tx->next_to_clean - mac->tx->next_to_use == TX_RING_SIZE;
516 515
517 if (!(*mac->tx_status & PAS_STATUS_INT)) 516 if (!(*mac->tx_status & PAS_STATUS_INT))
518 return IRQ_NONE; 517 return IRQ_NONE;
@@ -526,9 +525,6 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data)
526 pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), 525 pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_RESET(mac->dma_txch),
527 reg); 526 reg);
528 527
529 if (was_full)
530 netif_wake_queue(dev);
531
532 return IRQ_HANDLED; 528 return IRQ_HANDLED;
533} 529}
534 530
@@ -660,40 +656,37 @@ static int pasemi_mac_close(struct net_device *dev)
660 pci_read_config_dword(mac->dma_pdev, 656 pci_read_config_dword(mac->dma_pdev,
661 PAS_DMA_TXCHAN_TCMDSTA(mac->dma_txch), 657 PAS_DMA_TXCHAN_TCMDSTA(mac->dma_txch),
662 &stat); 658 &stat);
663 if (stat & PAS_DMA_TXCHAN_TCMDSTA_ACT) 659 if (!(stat & PAS_DMA_TXCHAN_TCMDSTA_ACT))
664 break; 660 break;
665 cond_resched(); 661 cond_resched();
666 } 662 }
667 663
668 if (!(stat & PAS_DMA_TXCHAN_TCMDSTA_ACT)) { 664 if (stat & PAS_DMA_TXCHAN_TCMDSTA_ACT)
669 dev_err(&mac->dma_pdev->dev, "Failed to stop tx channel\n"); 665 dev_err(&mac->dma_pdev->dev, "Failed to stop tx channel\n");
670 }
671 666
672 for (retries = 0; retries < MAX_RETRIES; retries++) { 667 for (retries = 0; retries < MAX_RETRIES; retries++) {
673 pci_read_config_dword(mac->dma_pdev, 668 pci_read_config_dword(mac->dma_pdev,
674 PAS_DMA_RXCHAN_CCMDSTA(mac->dma_rxch), 669 PAS_DMA_RXCHAN_CCMDSTA(mac->dma_rxch),
675 &stat); 670 &stat);
676 if (stat & PAS_DMA_RXCHAN_CCMDSTA_ACT) 671 if (!(stat & PAS_DMA_RXCHAN_CCMDSTA_ACT))
677 break; 672 break;
678 cond_resched(); 673 cond_resched();
679 } 674 }
680 675
681 if (!(stat & PAS_DMA_RXCHAN_CCMDSTA_ACT)) { 676 if (stat & PAS_DMA_RXCHAN_CCMDSTA_ACT)
682 dev_err(&mac->dma_pdev->dev, "Failed to stop rx channel\n"); 677 dev_err(&mac->dma_pdev->dev, "Failed to stop rx channel\n");
683 }
684 678
685 for (retries = 0; retries < MAX_RETRIES; retries++) { 679 for (retries = 0; retries < MAX_RETRIES; retries++) {
686 pci_read_config_dword(mac->dma_pdev, 680 pci_read_config_dword(mac->dma_pdev,
687 PAS_DMA_RXINT_RCMDSTA(mac->dma_if), 681 PAS_DMA_RXINT_RCMDSTA(mac->dma_if),
688 &stat); 682 &stat);
689 if (stat & PAS_DMA_RXINT_RCMDSTA_ACT) 683 if (!(stat & PAS_DMA_RXINT_RCMDSTA_ACT))
690 break; 684 break;
691 cond_resched(); 685 cond_resched();
692 } 686 }
693 687
694 if (!(stat & PAS_DMA_RXINT_RCMDSTA_ACT)) { 688 if (stat & PAS_DMA_RXINT_RCMDSTA_ACT)
695 dev_err(&mac->dma_pdev->dev, "Failed to stop rx interface\n"); 689 dev_err(&mac->dma_pdev->dev, "Failed to stop rx interface\n");
696 }
697 690
698 /* Then, disable the channel. This must be done separately from 691 /* Then, disable the channel. This must be done separately from
699 * stopping, since you can't disable when active. 692 * stopping, since you can't disable when active.