diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2006-01-17 16:43:17 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-17 19:27:30 -0500 |
commit | 3be92a70237a1bd813e46d6683a55b508627013a (patch) | |
tree | 1a7995f8b2c646e892f36543a0d70626b7b93aa5 | |
parent | a036119f977eeeae2089ddf5b4759de9ca5fbdb6 (diff) |
[PATCH] sky2: ratelimit error messages
Make sure and rate limit all the error messages that might occur. If a problem
occurs then a few messages are enough.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r-- | drivers/net/sky2.c | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 92ea915c1d4b..9308b3bbb5cb 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -92,7 +92,7 @@ | |||
92 | static const u32 default_msg = | 92 | static const u32 default_msg = |
93 | NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK | 93 | NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK |
94 | | NETIF_MSG_TIMER | NETIF_MSG_TX_ERR | NETIF_MSG_RX_ERR | 94 | | NETIF_MSG_TIMER | NETIF_MSG_TX_ERR | NETIF_MSG_RX_ERR |
95 | | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN | NETIF_MSG_INTR; | 95 | | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN; |
96 | 96 | ||
97 | static int debug = -1; /* defaults above */ | 97 | static int debug = -1; /* defaults above */ |
98 | module_param(debug, int, 0); | 98 | module_param(debug, int, 0); |
@@ -1125,8 +1125,9 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
1125 | */ | 1125 | */ |
1126 | if (!netif_queue_stopped(dev)) { | 1126 | if (!netif_queue_stopped(dev)) { |
1127 | netif_stop_queue(dev); | 1127 | netif_stop_queue(dev); |
1128 | printk(KERN_WARNING PFX "%s: ring full when queue awake!\n", | 1128 | if (net_ratelimit()) |
1129 | dev->name); | 1129 | printk(KERN_WARNING PFX "%s: ring full when queue awake!\n", |
1130 | dev->name); | ||
1130 | } | 1131 | } |
1131 | spin_unlock(&sky2->tx_lock); | 1132 | spin_unlock(&sky2->tx_lock); |
1132 | 1133 | ||
@@ -1770,7 +1771,7 @@ oversize: | |||
1770 | error: | 1771 | error: |
1771 | ++sky2->net_stats.rx_errors; | 1772 | ++sky2->net_stats.rx_errors; |
1772 | 1773 | ||
1773 | if (netif_msg_rx_err(sky2)) | 1774 | if (netif_msg_rx_err(sky2) && net_ratelimit()) |
1774 | printk(KERN_INFO PFX "%s: rx error, status 0x%x length %d\n", | 1775 | printk(KERN_INFO PFX "%s: rx error, status 0x%x length %d\n", |
1775 | sky2->netdev->name, status, length); | 1776 | sky2->netdev->name, status, length); |
1776 | 1777 | ||
@@ -1920,35 +1921,42 @@ static void sky2_hw_error(struct sky2_hw *hw, unsigned port, u32 status) | |||
1920 | { | 1921 | { |
1921 | struct net_device *dev = hw->dev[port]; | 1922 | struct net_device *dev = hw->dev[port]; |
1922 | 1923 | ||
1923 | printk(KERN_INFO PFX "%s: hw error interrupt status 0x%x\n", | 1924 | if (net_ratelimit()) |
1924 | dev->name, status); | 1925 | printk(KERN_INFO PFX "%s: hw error interrupt status 0x%x\n", |
1926 | dev->name, status); | ||
1925 | 1927 | ||
1926 | if (status & Y2_IS_PAR_RD1) { | 1928 | if (status & Y2_IS_PAR_RD1) { |
1927 | printk(KERN_ERR PFX "%s: ram data read parity error\n", | 1929 | if (net_ratelimit()) |
1928 | dev->name); | 1930 | printk(KERN_ERR PFX "%s: ram data read parity error\n", |
1931 | dev->name); | ||
1929 | /* Clear IRQ */ | 1932 | /* Clear IRQ */ |
1930 | sky2_write16(hw, RAM_BUFFER(port, B3_RI_CTRL), RI_CLR_RD_PERR); | 1933 | sky2_write16(hw, RAM_BUFFER(port, B3_RI_CTRL), RI_CLR_RD_PERR); |
1931 | } | 1934 | } |
1932 | 1935 | ||
1933 | if (status & Y2_IS_PAR_WR1) { | 1936 | if (status & Y2_IS_PAR_WR1) { |
1934 | printk(KERN_ERR PFX "%s: ram data write parity error\n", | 1937 | if (net_ratelimit()) |
1935 | dev->name); | 1938 | printk(KERN_ERR PFX "%s: ram data write parity error\n", |
1939 | dev->name); | ||
1936 | 1940 | ||
1937 | sky2_write16(hw, RAM_BUFFER(port, B3_RI_CTRL), RI_CLR_WR_PERR); | 1941 | sky2_write16(hw, RAM_BUFFER(port, B3_RI_CTRL), RI_CLR_WR_PERR); |
1938 | } | 1942 | } |
1939 | 1943 | ||
1940 | if (status & Y2_IS_PAR_MAC1) { | 1944 | if (status & Y2_IS_PAR_MAC1) { |
1941 | printk(KERN_ERR PFX "%s: MAC parity error\n", dev->name); | 1945 | if (net_ratelimit()) |
1946 | printk(KERN_ERR PFX "%s: MAC parity error\n", dev->name); | ||
1942 | sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_CLI_TX_PE); | 1947 | sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_CLI_TX_PE); |
1943 | } | 1948 | } |
1944 | 1949 | ||
1945 | if (status & Y2_IS_PAR_RX1) { | 1950 | if (status & Y2_IS_PAR_RX1) { |
1946 | printk(KERN_ERR PFX "%s: RX parity error\n", dev->name); | 1951 | if (net_ratelimit()) |
1952 | printk(KERN_ERR PFX "%s: RX parity error\n", dev->name); | ||
1947 | sky2_write32(hw, Q_ADDR(rxqaddr[port], Q_CSR), BMU_CLR_IRQ_PAR); | 1953 | sky2_write32(hw, Q_ADDR(rxqaddr[port], Q_CSR), BMU_CLR_IRQ_PAR); |
1948 | } | 1954 | } |
1949 | 1955 | ||
1950 | if (status & Y2_IS_TCP_TXA1) { | 1956 | if (status & Y2_IS_TCP_TXA1) { |
1951 | printk(KERN_ERR PFX "%s: TCP segmentation error\n", dev->name); | 1957 | if (net_ratelimit()) |
1958 | printk(KERN_ERR PFX "%s: TCP segmentation error\n", | ||
1959 | dev->name); | ||
1952 | sky2_write32(hw, Q_ADDR(txqaddr[port], Q_CSR), BMU_CLR_IRQ_TCP); | 1960 | sky2_write32(hw, Q_ADDR(txqaddr[port], Q_CSR), BMU_CLR_IRQ_TCP); |
1953 | } | 1961 | } |
1954 | } | 1962 | } |
@@ -1964,8 +1972,9 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
1964 | u16 pci_err; | 1972 | u16 pci_err; |
1965 | 1973 | ||
1966 | pci_read_config_word(hw->pdev, PCI_STATUS, &pci_err); | 1974 | pci_read_config_word(hw->pdev, PCI_STATUS, &pci_err); |
1967 | printk(KERN_ERR PFX "%s: pci hw error (0x%x)\n", | 1975 | if (net_ratelimit()) |
1968 | pci_name(hw->pdev), pci_err); | 1976 | printk(KERN_ERR PFX "%s: pci hw error (0x%x)\n", |
1977 | pci_name(hw->pdev), pci_err); | ||
1969 | 1978 | ||
1970 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | 1979 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); |
1971 | pci_write_config_word(hw->pdev, PCI_STATUS, | 1980 | pci_write_config_word(hw->pdev, PCI_STATUS, |
@@ -1979,8 +1988,9 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
1979 | 1988 | ||
1980 | pci_read_config_dword(hw->pdev, PEX_UNC_ERR_STAT, &pex_err); | 1989 | pci_read_config_dword(hw->pdev, PEX_UNC_ERR_STAT, &pex_err); |
1981 | 1990 | ||
1982 | printk(KERN_ERR PFX "%s: pci express error (0x%x)\n", | 1991 | if (net_ratelimit()) |
1983 | pci_name(hw->pdev), pex_err); | 1992 | printk(KERN_ERR PFX "%s: pci express error (0x%x)\n", |
1993 | pci_name(hw->pdev), pex_err); | ||
1984 | 1994 | ||
1985 | /* clear the interrupt */ | 1995 | /* clear the interrupt */ |
1986 | sky2_write32(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | 1996 | sky2_write32(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); |