diff options
author | Sergei Shtylyov <sshtylyov@ru.mvista.com> | 2007-02-15 08:56:01 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-17 15:26:45 -0500 |
commit | 538cc7ee7dddaedf9442f32ec4cc617a070ef341 (patch) | |
tree | c30210cbdb1ecef70825b4d124d3a90eccb51187 /drivers/net/gianfar.c | |
parent | 825811749b00f670b53e35ed342d5dc10d71c9de (diff) |
gianfar: don't duplicate gfar_error()
It was hardly necessary to repeat most of the code from gfar_error() in
gfar_interrupt(), especially having some inconsistencies between the two.
So, make the gfar_interrupt() just call gfar_error(), and not acknowledge
the interrupts itself as gfar_{receive/transmit/error}() do it anyway.
While at it, also clarify/cleanup debug messages in gfar_error()...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/gianfar.c')
-rw-r--r-- | drivers/net/gianfar.c | 85 |
1 files changed, 15 insertions, 70 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 1be4a84dce0e..1f83988a6a64 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * Maintainer: Kumar Gala | 10 | * Maintainer: Kumar Gala |
11 | * | 11 | * |
12 | * Copyright (c) 2002-2006 Freescale Semiconductor, Inc. | 12 | * Copyright (c) 2002-2006 Freescale Semiconductor, Inc. |
13 | * Copyright (c) 2007 MontaVista Software, Inc. | ||
13 | * | 14 | * |
14 | * This program is free software; you can redistribute it and/or modify it | 15 | * This program is free software; you can redistribute it and/or modify it |
15 | * under the terms of the GNU General Public License as published by the | 16 | * under the terms of the GNU General Public License as published by the |
@@ -1612,71 +1613,17 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id) | |||
1612 | /* Save ievent for future reference */ | 1613 | /* Save ievent for future reference */ |
1613 | u32 events = gfar_read(&priv->regs->ievent); | 1614 | u32 events = gfar_read(&priv->regs->ievent); |
1614 | 1615 | ||
1615 | /* Clear IEVENT */ | ||
1616 | gfar_write(&priv->regs->ievent, events); | ||
1617 | |||
1618 | /* Check for reception */ | 1616 | /* Check for reception */ |
1619 | if ((events & IEVENT_RXF0) || (events & IEVENT_RXB0)) | 1617 | if (events & IEVENT_RX_MASK) |
1620 | gfar_receive(irq, dev_id); | 1618 | gfar_receive(irq, dev_id); |
1621 | 1619 | ||
1622 | /* Check for transmit completion */ | 1620 | /* Check for transmit completion */ |
1623 | if ((events & IEVENT_TXF) || (events & IEVENT_TXB)) | 1621 | if (events & IEVENT_TX_MASK) |
1624 | gfar_transmit(irq, dev_id); | 1622 | gfar_transmit(irq, dev_id); |
1625 | 1623 | ||
1626 | /* Update error statistics */ | 1624 | /* Check for errors */ |
1627 | if (events & IEVENT_TXE) { | 1625 | if (events & IEVENT_ERR_MASK) |
1628 | priv->stats.tx_errors++; | 1626 | gfar_error(irq, dev_id); |
1629 | |||
1630 | if (events & IEVENT_LC) | ||
1631 | priv->stats.tx_window_errors++; | ||
1632 | if (events & IEVENT_CRL) | ||
1633 | priv->stats.tx_aborted_errors++; | ||
1634 | if (events & IEVENT_XFUN) { | ||
1635 | if (netif_msg_tx_err(priv)) | ||
1636 | printk(KERN_WARNING "%s: tx underrun. dropped packet\n", dev->name); | ||
1637 | priv->stats.tx_dropped++; | ||
1638 | priv->extra_stats.tx_underrun++; | ||
1639 | |||
1640 | /* Reactivate the Tx Queues */ | ||
1641 | gfar_write(&priv->regs->tstat, TSTAT_CLEAR_THALT); | ||
1642 | } | ||
1643 | } | ||
1644 | if (events & IEVENT_BSY) { | ||
1645 | priv->stats.rx_errors++; | ||
1646 | priv->extra_stats.rx_bsy++; | ||
1647 | |||
1648 | gfar_receive(irq, dev_id); | ||
1649 | |||
1650 | #ifndef CONFIG_GFAR_NAPI | ||
1651 | /* Clear the halt bit in RSTAT */ | ||
1652 | gfar_write(&priv->regs->rstat, RSTAT_CLEAR_RHALT); | ||
1653 | #endif | ||
1654 | |||
1655 | if (netif_msg_rx_err(priv)) | ||
1656 | printk(KERN_DEBUG "%s: busy error (rhalt: %x)\n", | ||
1657 | dev->name, | ||
1658 | gfar_read(&priv->regs->rstat)); | ||
1659 | } | ||
1660 | if (events & IEVENT_BABR) { | ||
1661 | priv->stats.rx_errors++; | ||
1662 | priv->extra_stats.rx_babr++; | ||
1663 | |||
1664 | if (netif_msg_rx_err(priv)) | ||
1665 | printk(KERN_DEBUG "%s: babbling error\n", dev->name); | ||
1666 | } | ||
1667 | if (events & IEVENT_EBERR) { | ||
1668 | priv->extra_stats.eberr++; | ||
1669 | if (netif_msg_rx_err(priv)) | ||
1670 | printk(KERN_DEBUG "%s: EBERR\n", dev->name); | ||
1671 | } | ||
1672 | if ((events & IEVENT_RXC) && (netif_msg_rx_err(priv))) | ||
1673 | printk(KERN_DEBUG "%s: control frame\n", dev->name); | ||
1674 | |||
1675 | if (events & IEVENT_BABT) { | ||
1676 | priv->extra_stats.tx_babt++; | ||
1677 | if (netif_msg_rx_err(priv)) | ||
1678 | printk(KERN_DEBUG "%s: babt error\n", dev->name); | ||
1679 | } | ||
1680 | 1627 | ||
1681 | return IRQ_HANDLED; | 1628 | return IRQ_HANDLED; |
1682 | } | 1629 | } |
@@ -1938,7 +1885,7 @@ static irqreturn_t gfar_error(int irq, void *dev_id) | |||
1938 | /* Hmm... */ | 1885 | /* Hmm... */ |
1939 | if (netif_msg_rx_err(priv) || netif_msg_tx_err(priv)) | 1886 | if (netif_msg_rx_err(priv) || netif_msg_tx_err(priv)) |
1940 | printk(KERN_DEBUG "%s: error interrupt (ievent=0x%08x imask=0x%08x)\n", | 1887 | printk(KERN_DEBUG "%s: error interrupt (ievent=0x%08x imask=0x%08x)\n", |
1941 | dev->name, events, gfar_read(&priv->regs->imask)); | 1888 | dev->name, events, gfar_read(&priv->regs->imask)); |
1942 | 1889 | ||
1943 | /* Update the error counters */ | 1890 | /* Update the error counters */ |
1944 | if (events & IEVENT_TXE) { | 1891 | if (events & IEVENT_TXE) { |
@@ -1950,8 +1897,8 @@ static irqreturn_t gfar_error(int irq, void *dev_id) | |||
1950 | priv->stats.tx_aborted_errors++; | 1897 | priv->stats.tx_aborted_errors++; |
1951 | if (events & IEVENT_XFUN) { | 1898 | if (events & IEVENT_XFUN) { |
1952 | if (netif_msg_tx_err(priv)) | 1899 | if (netif_msg_tx_err(priv)) |
1953 | printk(KERN_DEBUG "%s: underrun. packet dropped.\n", | 1900 | printk(KERN_DEBUG "%s: TX FIFO underrun, " |
1954 | dev->name); | 1901 | "packet dropped.\n", dev->name); |
1955 | priv->stats.tx_dropped++; | 1902 | priv->stats.tx_dropped++; |
1956 | priv->extra_stats.tx_underrun++; | 1903 | priv->extra_stats.tx_underrun++; |
1957 | 1904 | ||
@@ -1973,30 +1920,28 @@ static irqreturn_t gfar_error(int irq, void *dev_id) | |||
1973 | #endif | 1920 | #endif |
1974 | 1921 | ||
1975 | if (netif_msg_rx_err(priv)) | 1922 | if (netif_msg_rx_err(priv)) |
1976 | printk(KERN_DEBUG "%s: busy error (rhalt: %x)\n", | 1923 | printk(KERN_DEBUG "%s: busy error (rstat: %x)\n", |
1977 | dev->name, | 1924 | dev->name, gfar_read(&priv->regs->rstat)); |
1978 | gfar_read(&priv->regs->rstat)); | ||
1979 | } | 1925 | } |
1980 | if (events & IEVENT_BABR) { | 1926 | if (events & IEVENT_BABR) { |
1981 | priv->stats.rx_errors++; | 1927 | priv->stats.rx_errors++; |
1982 | priv->extra_stats.rx_babr++; | 1928 | priv->extra_stats.rx_babr++; |
1983 | 1929 | ||
1984 | if (netif_msg_rx_err(priv)) | 1930 | if (netif_msg_rx_err(priv)) |
1985 | printk(KERN_DEBUG "%s: babbling error\n", dev->name); | 1931 | printk(KERN_DEBUG "%s: babbling RX error\n", dev->name); |
1986 | } | 1932 | } |
1987 | if (events & IEVENT_EBERR) { | 1933 | if (events & IEVENT_EBERR) { |
1988 | priv->extra_stats.eberr++; | 1934 | priv->extra_stats.eberr++; |
1989 | if (netif_msg_rx_err(priv)) | 1935 | if (netif_msg_rx_err(priv)) |
1990 | printk(KERN_DEBUG "%s: EBERR\n", dev->name); | 1936 | printk(KERN_DEBUG "%s: bus error\n", dev->name); |
1991 | } | 1937 | } |
1992 | if ((events & IEVENT_RXC) && netif_msg_rx_status(priv)) | 1938 | if ((events & IEVENT_RXC) && netif_msg_rx_status(priv)) |
1993 | if (netif_msg_rx_status(priv)) | 1939 | printk(KERN_DEBUG "%s: control frame\n", dev->name); |
1994 | printk(KERN_DEBUG "%s: control frame\n", dev->name); | ||
1995 | 1940 | ||
1996 | if (events & IEVENT_BABT) { | 1941 | if (events & IEVENT_BABT) { |
1997 | priv->extra_stats.tx_babt++; | 1942 | priv->extra_stats.tx_babt++; |
1998 | if (netif_msg_tx_err(priv)) | 1943 | if (netif_msg_tx_err(priv)) |
1999 | printk(KERN_DEBUG "%s: babt error\n", dev->name); | 1944 | printk(KERN_DEBUG "%s: babbling TX error\n", dev->name); |
2000 | } | 1945 | } |
2001 | return IRQ_HANDLED; | 1946 | return IRQ_HANDLED; |
2002 | } | 1947 | } |