aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2007-05-08 01:47:32 -0400
committerJeff Garzik <jeff@garzik.org>2007-05-08 01:47:53 -0400
commit6dfa7522d8b08c887bf9f4cb2600b89232f132f5 (patch)
treef7c4257096c29d5c3d99399833e017bab8c443ae
parent1b0335ea30bf85eecffd21be64b7653407d6259a (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>
-rw-r--r--drivers/net/pasemi_mac.c41
-rw-r--r--drivers/net/pasemi_mac.h1
2 files changed, 30 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), &reg);
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
diff --git a/drivers/net/pasemi_mac.h b/drivers/net/pasemi_mac.h
index 703f1b0d434f..88edaa51c661 100644
--- a/drivers/net/pasemi_mac.h
+++ b/drivers/net/pasemi_mac.h
@@ -299,6 +299,7 @@ enum {
299#define PAS_STATUS_DCNT_S 16 299#define PAS_STATUS_DCNT_S 16
300#define PAS_STATUS_BPCNT_M 0x0000ffff00000000ull 300#define PAS_STATUS_BPCNT_M 0x0000ffff00000000ull
301#define PAS_STATUS_BPCNT_S 32 301#define PAS_STATUS_BPCNT_S 32
302#define PAS_STATUS_CAUSE_M 0xf000000000000000ull
302#define PAS_STATUS_TIMER 0x1000000000000000ull 303#define PAS_STATUS_TIMER 0x1000000000000000ull
303#define PAS_STATUS_ERROR 0x2000000000000000ull 304#define PAS_STATUS_ERROR 0x2000000000000000ull
304#define PAS_STATUS_SOFT 0x4000000000000000ull 305#define PAS_STATUS_SOFT 0x4000000000000000ull