aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2008-04-10 11:24:12 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-04-16 20:06:49 -0400
commitc201abd9a49e72824d274bc1a91b8ba300e37d9a (patch)
tree8fcbf5327b7f86f9256099f46b7030ba835f24af /drivers
parent4547fa615f2d60e80e11d7ac2488c982bddeabdc (diff)
tc35815: Statistics cleanup
Use struct net_device_stats embedded in struct net_device. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/tc35815.c61
1 files changed, 31 insertions, 30 deletions
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index 370d329d15d9..f0e9566f787e 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -418,7 +418,6 @@ struct tc35815_local {
418 struct napi_struct napi; 418 struct napi_struct napi;
419 419
420 /* statistics */ 420 /* statistics */
421 struct net_device_stats stats;
422 struct { 421 struct {
423 int max_tx_qlen; 422 int max_tx_qlen;
424 int tx_ints; 423 int tx_ints;
@@ -1192,7 +1191,7 @@ static void tc35815_tx_timeout(struct net_device *dev)
1192 tc35815_restart(dev); 1191 tc35815_restart(dev);
1193 spin_unlock_irq(&lp->lock); 1192 spin_unlock_irq(&lp->lock);
1194 1193
1195 lp->stats.tx_errors++; 1194 dev->stats.tx_errors++;
1196 1195
1197 /* If we have space available to accept new transmit 1196 /* If we have space available to accept new transmit
1198 * requests, wake up the queueing layer. This would 1197 * requests, wake up the queueing layer. This would
@@ -1392,7 +1391,7 @@ static int tc35815_do_interrupt(struct net_device *dev, u32 status)
1392 printk(KERN_WARNING 1391 printk(KERN_WARNING
1393 "%s: Free Descriptor Area Exhausted (%#x).\n", 1392 "%s: Free Descriptor Area Exhausted (%#x).\n",
1394 dev->name, status); 1393 dev->name, status);
1395 lp->stats.rx_dropped++; 1394 dev->stats.rx_dropped++;
1396 ret = 0; 1395 ret = 0;
1397 } 1396 }
1398 if (status & Int_IntBLEx) { 1397 if (status & Int_IntBLEx) {
@@ -1401,14 +1400,14 @@ static int tc35815_do_interrupt(struct net_device *dev, u32 status)
1401 printk(KERN_WARNING 1400 printk(KERN_WARNING
1402 "%s: Buffer List Exhausted (%#x).\n", 1401 "%s: Buffer List Exhausted (%#x).\n",
1403 dev->name, status); 1402 dev->name, status);
1404 lp->stats.rx_dropped++; 1403 dev->stats.rx_dropped++;
1405 ret = 0; 1404 ret = 0;
1406 } 1405 }
1407 if (status & Int_IntExBD) { 1406 if (status & Int_IntExBD) {
1408 printk(KERN_WARNING 1407 printk(KERN_WARNING
1409 "%s: Excessive Buffer Descriptiors (%#x).\n", 1408 "%s: Excessive Buffer Descriptiors (%#x).\n",
1410 dev->name, status); 1409 dev->name, status);
1411 lp->stats.rx_length_errors++; 1410 dev->stats.rx_length_errors++;
1412 ret = 0; 1411 ret = 0;
1413 } 1412 }
1414 1413
@@ -1532,7 +1531,7 @@ tc35815_rx(struct net_device *dev)
1532 if (skb == NULL) { 1531 if (skb == NULL) {
1533 printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", 1532 printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n",
1534 dev->name); 1533 dev->name);
1535 lp->stats.rx_dropped++; 1534 dev->stats.rx_dropped++;
1536 break; 1535 break;
1537 } 1536 }
1538 skb_reserve(skb, 2); /* 16 bit alignment */ 1537 skb_reserve(skb, 2); /* 16 bit alignment */
@@ -1602,10 +1601,10 @@ tc35815_rx(struct net_device *dev)
1602 netif_rx(skb); 1601 netif_rx(skb);
1603#endif 1602#endif
1604 dev->last_rx = jiffies; 1603 dev->last_rx = jiffies;
1605 lp->stats.rx_packets++; 1604 dev->stats.rx_packets++;
1606 lp->stats.rx_bytes += pkt_len; 1605 dev->stats.rx_bytes += pkt_len;
1607 } else { 1606 } else {
1608 lp->stats.rx_errors++; 1607 dev->stats.rx_errors++;
1609 printk(KERN_DEBUG "%s: Rx error (status %x)\n", 1608 printk(KERN_DEBUG "%s: Rx error (status %x)\n",
1610 dev->name, status & Rx_Stat_Mask); 1609 dev->name, status & Rx_Stat_Mask);
1611 /* WORKAROUND: LongErr and CRCErr means Overflow. */ 1610 /* WORKAROUND: LongErr and CRCErr means Overflow. */
@@ -1613,10 +1612,14 @@ tc35815_rx(struct net_device *dev)
1613 status &= ~(Rx_LongErr|Rx_CRCErr); 1612 status &= ~(Rx_LongErr|Rx_CRCErr);
1614 status |= Rx_Over; 1613 status |= Rx_Over;
1615 } 1614 }
1616 if (status & Rx_LongErr) lp->stats.rx_length_errors++; 1615 if (status & Rx_LongErr)
1617 if (status & Rx_Over) lp->stats.rx_fifo_errors++; 1616 dev->stats.rx_length_errors++;
1618 if (status & Rx_CRCErr) lp->stats.rx_crc_errors++; 1617 if (status & Rx_Over)
1619 if (status & Rx_Align) lp->stats.rx_frame_errors++; 1618 dev->stats.rx_fifo_errors++;
1619 if (status & Rx_CRCErr)
1620 dev->stats.rx_crc_errors++;
1621 if (status & Rx_Align)
1622 dev->stats.rx_frame_errors++;
1620 } 1623 }
1621 1624
1622 if (bd_count > 0) { 1625 if (bd_count > 0) {
@@ -1777,9 +1780,9 @@ tc35815_check_tx_stat(struct net_device *dev, int status)
1777 1780
1778 /* count collisions */ 1781 /* count collisions */
1779 if (status & Tx_ExColl) 1782 if (status & Tx_ExColl)
1780 lp->stats.collisions += 16; 1783 dev->stats.collisions += 16;
1781 if (status & Tx_TxColl_MASK) 1784 if (status & Tx_TxColl_MASK)
1782 lp->stats.collisions += status & Tx_TxColl_MASK; 1785 dev->stats.collisions += status & Tx_TxColl_MASK;
1783 1786
1784#ifndef NO_CHECK_CARRIER 1787#ifndef NO_CHECK_CARRIER
1785 /* TX4939 does not have NCarr */ 1788 /* TX4939 does not have NCarr */
@@ -1795,17 +1798,17 @@ tc35815_check_tx_stat(struct net_device *dev, int status)
1795 1798
1796 if (!(status & TX_STA_ERR)) { 1799 if (!(status & TX_STA_ERR)) {
1797 /* no error. */ 1800 /* no error. */
1798 lp->stats.tx_packets++; 1801 dev->stats.tx_packets++;
1799 return; 1802 return;
1800 } 1803 }
1801 1804
1802 lp->stats.tx_errors++; 1805 dev->stats.tx_errors++;
1803 if (status & Tx_ExColl) { 1806 if (status & Tx_ExColl) {
1804 lp->stats.tx_aborted_errors++; 1807 dev->stats.tx_aborted_errors++;
1805 msg = "Excessive Collision."; 1808 msg = "Excessive Collision.";
1806 } 1809 }
1807 if (status & Tx_Under) { 1810 if (status & Tx_Under) {
1808 lp->stats.tx_fifo_errors++; 1811 dev->stats.tx_fifo_errors++;
1809 msg = "Tx FIFO Underrun."; 1812 msg = "Tx FIFO Underrun.";
1810 if (lp->lstats.tx_underrun < TX_THRESHOLD_KEEP_LIMIT) { 1813 if (lp->lstats.tx_underrun < TX_THRESHOLD_KEEP_LIMIT) {
1811 lp->lstats.tx_underrun++; 1814 lp->lstats.tx_underrun++;
@@ -1818,25 +1821,25 @@ tc35815_check_tx_stat(struct net_device *dev, int status)
1818 } 1821 }
1819 } 1822 }
1820 if (status & Tx_Defer) { 1823 if (status & Tx_Defer) {
1821 lp->stats.tx_fifo_errors++; 1824 dev->stats.tx_fifo_errors++;
1822 msg = "Excessive Deferral."; 1825 msg = "Excessive Deferral.";
1823 } 1826 }
1824#ifndef NO_CHECK_CARRIER 1827#ifndef NO_CHECK_CARRIER
1825 if (status & Tx_NCarr) { 1828 if (status & Tx_NCarr) {
1826 lp->stats.tx_carrier_errors++; 1829 dev->stats.tx_carrier_errors++;
1827 msg = "Lost Carrier Sense."; 1830 msg = "Lost Carrier Sense.";
1828 } 1831 }
1829#endif 1832#endif
1830 if (status & Tx_LateColl) { 1833 if (status & Tx_LateColl) {
1831 lp->stats.tx_aborted_errors++; 1834 dev->stats.tx_aborted_errors++;
1832 msg = "Late Collision."; 1835 msg = "Late Collision.";
1833 } 1836 }
1834 if (status & Tx_TxPar) { 1837 if (status & Tx_TxPar) {
1835 lp->stats.tx_fifo_errors++; 1838 dev->stats.tx_fifo_errors++;
1836 msg = "Transmit Parity Error."; 1839 msg = "Transmit Parity Error.";
1837 } 1840 }
1838 if (status & Tx_SQErr) { 1841 if (status & Tx_SQErr) {
1839 lp->stats.tx_heartbeat_errors++; 1842 dev->stats.tx_heartbeat_errors++;
1840 msg = "Signal Quality Error."; 1843 msg = "Signal Quality Error.";
1841 } 1844 }
1842 if (msg && netif_msg_tx_err(lp)) 1845 if (msg && netif_msg_tx_err(lp))
@@ -1878,7 +1881,7 @@ tc35815_txdone(struct net_device *dev)
1878 BUG_ON(lp->tx_skbs[lp->tfd_end].skb != skb); 1881 BUG_ON(lp->tx_skbs[lp->tfd_end].skb != skb);
1879#endif 1882#endif
1880 if (skb) { 1883 if (skb) {
1881 lp->stats.tx_bytes += skb->len; 1884 dev->stats.tx_bytes += skb->len;
1882 pci_unmap_single(lp->pci_dev, lp->tx_skbs[lp->tfd_end].skb_dma, skb->len, PCI_DMA_TODEVICE); 1885 pci_unmap_single(lp->pci_dev, lp->tx_skbs[lp->tfd_end].skb_dma, skb->len, PCI_DMA_TODEVICE);
1883 lp->tx_skbs[lp->tfd_end].skb = NULL; 1886 lp->tx_skbs[lp->tfd_end].skb = NULL;
1884 lp->tx_skbs[lp->tfd_end].skb_dma = 0; 1887 lp->tx_skbs[lp->tfd_end].skb_dma = 0;
@@ -1972,15 +1975,13 @@ tc35815_close(struct net_device *dev)
1972 */ 1975 */
1973static struct net_device_stats *tc35815_get_stats(struct net_device *dev) 1976static struct net_device_stats *tc35815_get_stats(struct net_device *dev)
1974{ 1977{
1975 struct tc35815_local *lp = dev->priv;
1976 struct tc35815_regs __iomem *tr = 1978 struct tc35815_regs __iomem *tr =
1977 (struct tc35815_regs __iomem *)dev->base_addr; 1979 (struct tc35815_regs __iomem *)dev->base_addr;
1978 if (netif_running(dev)) { 1980 if (netif_running(dev))
1979 /* Update the statistics from the device registers. */ 1981 /* Update the statistics from the device registers. */
1980 lp->stats.rx_missed_errors = tc_readl(&tr->Miss_Cnt); 1982 dev->stats.rx_missed_errors = tc_readl(&tr->Miss_Cnt);
1981 }
1982 1983
1983 return &lp->stats; 1984 return &dev->stats;
1984} 1985}
1985 1986
1986static void tc35815_set_cam_entry(struct net_device *dev, int index, unsigned char *addr) 1987static void tc35815_set_cam_entry(struct net_device *dev, int index, unsigned char *addr)