diff options
author | Olof Johansson <olof@lixom.net> | 2007-05-08 01:47:32 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-05-08 01:47:53 -0400 |
commit | 6dfa7522d8b08c887bf9f4cb2600b89232f132f5 (patch) | |
tree | f7c4257096c29d5c3d99399833e017bab8c443ae /drivers/net/pasemi_mac.c | |
parent | 1b0335ea30bf85eecffd21be64b7653407d6259a (diff) |
pasemi_mac: Timer and interrupt fixes
Timer and interrupt fixes:
* Be pickier with what kind of interrupts are acked to avoid the device to
get out of sync with the driver state
* Set RX count threshhold to 1 (for NAPI interrupted mode), TX count
threshold to 32.
* Set timer thresholds to current max (~16ms).
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/pasemi_mac.c')
-rw-r--r-- | drivers/net/pasemi_mac.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index 73e79f35a428..2bf13cf55358 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -526,18 +526,28 @@ static irqreturn_t pasemi_mac_rx_intr(int irq, void *data) | |||
526 | struct pasemi_mac *mac = netdev_priv(dev); | 526 | struct pasemi_mac *mac = netdev_priv(dev); |
527 | unsigned int reg; | 527 | unsigned int reg; |
528 | 528 | ||
529 | if (!(*mac->rx_status & PAS_STATUS_INT)) | 529 | if (!(*mac->rx_status & PAS_STATUS_CAUSE_M)) |
530 | return IRQ_NONE; | 530 | return IRQ_NONE; |
531 | 531 | ||
532 | netif_rx_schedule(dev); | 532 | if (*mac->rx_status & PAS_STATUS_ERROR) |
533 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_COM_TIMEOUTCFG, | 533 | printk("rx_status reported error\n"); |
534 | PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(0)); | 534 | |
535 | /* Don't reset packet count so it won't fire again but clear | ||
536 | * all others. | ||
537 | */ | ||
538 | |||
539 | pci_read_config_dword(mac->dma_pdev, PAS_DMA_RXINT_RCMDSTA(mac->dma_if), ®); | ||
535 | 540 | ||
536 | reg = PAS_IOB_DMA_RXCH_RESET_PINTC | PAS_IOB_DMA_RXCH_RESET_SINTC | | 541 | reg = 0; |
537 | PAS_IOB_DMA_RXCH_RESET_DINTC; | 542 | if (*mac->rx_status & PAS_STATUS_SOFT) |
543 | reg |= PAS_IOB_DMA_RXCH_RESET_SINTC; | ||
544 | if (*mac->rx_status & PAS_STATUS_ERROR) | ||
545 | reg |= PAS_IOB_DMA_RXCH_RESET_DINTC; | ||
538 | if (*mac->rx_status & PAS_STATUS_TIMER) | 546 | if (*mac->rx_status & PAS_STATUS_TIMER) |
539 | reg |= PAS_IOB_DMA_RXCH_RESET_TINTC; | 547 | reg |= PAS_IOB_DMA_RXCH_RESET_TINTC; |
540 | 548 | ||
549 | netif_rx_schedule(dev); | ||
550 | |||
541 | pci_write_config_dword(mac->iob_pdev, | 551 | pci_write_config_dword(mac->iob_pdev, |
542 | PAS_IOB_DMA_RXCH_RESET(mac->dma_rxch), reg); | 552 | PAS_IOB_DMA_RXCH_RESET(mac->dma_rxch), reg); |
543 | 553 | ||
@@ -551,14 +561,17 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data) | |||
551 | struct pasemi_mac *mac = netdev_priv(dev); | 561 | struct pasemi_mac *mac = netdev_priv(dev); |
552 | unsigned int reg; | 562 | unsigned int reg; |
553 | 563 | ||
554 | if (!(*mac->tx_status & PAS_STATUS_INT)) | 564 | if (!(*mac->tx_status & PAS_STATUS_CAUSE_M)) |
555 | return IRQ_NONE; | 565 | return IRQ_NONE; |
556 | 566 | ||
557 | pasemi_mac_clean_tx(mac); | 567 | pasemi_mac_clean_tx(mac); |
558 | 568 | ||
559 | reg = PAS_IOB_DMA_TXCH_RESET_PINTC | PAS_IOB_DMA_TXCH_RESET_SINTC; | 569 | reg = PAS_IOB_DMA_TXCH_RESET_PINTC; |
560 | if (*mac->tx_status & PAS_STATUS_TIMER) | 570 | |
561 | reg |= PAS_IOB_DMA_TXCH_RESET_TINTC; | 571 | if (*mac->tx_status & PAS_STATUS_SOFT) |
572 | reg |= PAS_IOB_DMA_TXCH_RESET_SINTC; | ||
573 | if (*mac->tx_status & PAS_STATUS_ERROR) | ||
574 | reg |= PAS_IOB_DMA_TXCH_RESET_DINTC; | ||
562 | 575 | ||
563 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), | 576 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), |
564 | reg); | 577 | reg); |
@@ -593,14 +606,18 @@ static int pasemi_mac_open(struct net_device *dev) | |||
593 | flags |= PAS_MAC_CFG_PCFG_TSR_1G | PAS_MAC_CFG_PCFG_SPD_1G; | 606 | flags |= PAS_MAC_CFG_PCFG_TSR_1G | PAS_MAC_CFG_PCFG_SPD_1G; |
594 | 607 | ||
595 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_RXCH_CFG(mac->dma_rxch), | 608 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_RXCH_CFG(mac->dma_rxch), |
596 | PAS_IOB_DMA_RXCH_CFG_CNTTH(30)); | 609 | PAS_IOB_DMA_RXCH_CFG_CNTTH(1)); |
610 | |||
611 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_CFG(mac->dma_txch), | ||
612 | PAS_IOB_DMA_TXCH_CFG_CNTTH(32)); | ||
597 | 613 | ||
598 | /* Clear out any residual packet count state from firmware */ | 614 | /* Clear out any residual packet count state from firmware */ |
599 | pasemi_mac_restart_rx_intr(mac); | 615 | pasemi_mac_restart_rx_intr(mac); |
600 | pasemi_mac_restart_tx_intr(mac); | 616 | pasemi_mac_restart_tx_intr(mac); |
601 | 617 | ||
618 | /* 0xffffff is max value, about 16ms */ | ||
602 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_COM_TIMEOUTCFG, | 619 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_COM_TIMEOUTCFG, |
603 | PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(1000000)); | 620 | PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(0xffffff)); |
604 | 621 | ||
605 | pci_write_config_dword(mac->pdev, PAS_MAC_CFG_PCFG, flags); | 622 | pci_write_config_dword(mac->pdev, PAS_MAC_CFG_PCFG, flags); |
606 | 623 | ||