aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-03-20 15:36:09 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-22 01:37:55 -0400
commit6fb7298cdbe200b3b19cd59046785aecb0844198 (patch)
treefb8d6a01f90781f42de99aca14ea914c8426b2e0 /drivers/net/pcmcia
parent0cd6e828a3cfb9c5bb71827ae6ee1564bf465f48 (diff)
smc91c92: convert to internal net_device_stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/pcmcia')
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c56
1 files changed, 22 insertions, 34 deletions
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index fccd53ef3c64..41de04162e91 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -108,7 +108,7 @@ struct smc_private {
108 spinlock_t lock; 108 spinlock_t lock;
109 u_short manfid; 109 u_short manfid;
110 u_short cardid; 110 u_short cardid;
111 struct net_device_stats stats; 111
112 dev_node_t node; 112 dev_node_t node;
113 struct sk_buff *saved_skb; 113 struct sk_buff *saved_skb;
114 int packets_waiting; 114 int packets_waiting;
@@ -289,7 +289,6 @@ static void smc_tx_timeout(struct net_device *dev);
289static int smc_start_xmit(struct sk_buff *skb, struct net_device *dev); 289static int smc_start_xmit(struct sk_buff *skb, struct net_device *dev);
290static irqreturn_t smc_interrupt(int irq, void *dev_id); 290static irqreturn_t smc_interrupt(int irq, void *dev_id);
291static void smc_rx(struct net_device *dev); 291static void smc_rx(struct net_device *dev);
292static struct net_device_stats *smc_get_stats(struct net_device *dev);
293static void set_rx_mode(struct net_device *dev); 292static void set_rx_mode(struct net_device *dev);
294static int s9k_config(struct net_device *dev, struct ifmap *map); 293static int s9k_config(struct net_device *dev, struct ifmap *map);
295static void smc_set_xcvr(struct net_device *dev, int if_port); 294static void smc_set_xcvr(struct net_device *dev, int if_port);
@@ -337,7 +336,6 @@ static int smc91c92_probe(struct pcmcia_device *link)
337 336
338 /* The SMC91c92-specific entries in the device structure. */ 337 /* The SMC91c92-specific entries in the device structure. */
339 dev->hard_start_xmit = &smc_start_xmit; 338 dev->hard_start_xmit = &smc_start_xmit;
340 dev->get_stats = &smc_get_stats;
341 dev->set_config = &s9k_config; 339 dev->set_config = &s9k_config;
342 dev->set_multicast_list = &set_rx_mode; 340 dev->set_multicast_list = &set_rx_mode;
343 dev->open = &smc_open; 341 dev->open = &smc_open;
@@ -1291,7 +1289,7 @@ static void smc_hardware_send_packet(struct net_device * dev)
1291 return; 1289 return;
1292 } 1290 }
1293 1291
1294 smc->stats.tx_bytes += skb->len; 1292 dev->stats.tx_bytes += skb->len;
1295 /* The card should use the just-allocated buffer. */ 1293 /* The card should use the just-allocated buffer. */
1296 outw(packet_no, ioaddr + PNR_ARR); 1294 outw(packet_no, ioaddr + PNR_ARR);
1297 /* point to the beginning of the packet */ 1295 /* point to the beginning of the packet */
@@ -1340,7 +1338,7 @@ static void smc_tx_timeout(struct net_device *dev)
1340 printk(KERN_NOTICE "%s: SMC91c92 transmit timed out, " 1338 printk(KERN_NOTICE "%s: SMC91c92 transmit timed out, "
1341 "Tx_status %2.2x status %4.4x.\n", 1339 "Tx_status %2.2x status %4.4x.\n",
1342 dev->name, inw(ioaddr)&0xff, inw(ioaddr + 2)); 1340 dev->name, inw(ioaddr)&0xff, inw(ioaddr + 2));
1343 smc->stats.tx_errors++; 1341 dev->stats.tx_errors++;
1344 smc_reset(dev); 1342 smc_reset(dev);
1345 dev->trans_start = jiffies; 1343 dev->trans_start = jiffies;
1346 smc->saved_skb = NULL; 1344 smc->saved_skb = NULL;
@@ -1362,7 +1360,7 @@ static int smc_start_xmit(struct sk_buff *skb, struct net_device *dev)
1362 1360
1363 if (smc->saved_skb) { 1361 if (smc->saved_skb) {
1364 /* THIS SHOULD NEVER HAPPEN. */ 1362 /* THIS SHOULD NEVER HAPPEN. */
1365 smc->stats.tx_aborted_errors++; 1363 dev->stats.tx_aborted_errors++;
1366 printk(KERN_DEBUG "%s: Internal error -- sent packet while busy.\n", 1364 printk(KERN_DEBUG "%s: Internal error -- sent packet while busy.\n",
1367 dev->name); 1365 dev->name);
1368 return 1; 1366 return 1;
@@ -1375,7 +1373,7 @@ static int smc_start_xmit(struct sk_buff *skb, struct net_device *dev)
1375 printk(KERN_ERR "%s: Far too big packet error.\n", dev->name); 1373 printk(KERN_ERR "%s: Far too big packet error.\n", dev->name);
1376 dev_kfree_skb (skb); 1374 dev_kfree_skb (skb);
1377 smc->saved_skb = NULL; 1375 smc->saved_skb = NULL;
1378 smc->stats.tx_dropped++; 1376 dev->stats.tx_dropped++;
1379 return 0; /* Do not re-queue this packet. */ 1377 return 0; /* Do not re-queue this packet. */
1380 } 1378 }
1381 /* A packet is now waiting. */ 1379 /* A packet is now waiting. */
@@ -1433,11 +1431,11 @@ static void smc_tx_err(struct net_device * dev)
1433 1431
1434 tx_status = inw(ioaddr + DATA_1); 1432 tx_status = inw(ioaddr + DATA_1);
1435 1433
1436 smc->stats.tx_errors++; 1434 dev->stats.tx_errors++;
1437 if (tx_status & TS_LOSTCAR) smc->stats.tx_carrier_errors++; 1435 if (tx_status & TS_LOSTCAR) dev->stats.tx_carrier_errors++;
1438 if (tx_status & TS_LATCOL) smc->stats.tx_window_errors++; 1436 if (tx_status & TS_LATCOL) dev->stats.tx_window_errors++;
1439 if (tx_status & TS_16COL) { 1437 if (tx_status & TS_16COL) {
1440 smc->stats.tx_aborted_errors++; 1438 dev->stats.tx_aborted_errors++;
1441 smc->tx_err++; 1439 smc->tx_err++;
1442 } 1440 }
1443 1441
@@ -1474,10 +1472,10 @@ static void smc_eph_irq(struct net_device *dev)
1474 /* Could be a counter roll-over warning: update stats. */ 1472 /* Could be a counter roll-over warning: update stats. */
1475 card_stats = inw(ioaddr + COUNTER); 1473 card_stats = inw(ioaddr + COUNTER);
1476 /* single collisions */ 1474 /* single collisions */
1477 smc->stats.collisions += card_stats & 0xF; 1475 dev->stats.collisions += card_stats & 0xF;
1478 card_stats >>= 4; 1476 card_stats >>= 4;
1479 /* multiple collisions */ 1477 /* multiple collisions */
1480 smc->stats.collisions += card_stats & 0xF; 1478 dev->stats.collisions += card_stats & 0xF;
1481#if 0 /* These are for when linux supports these statistics */ 1479#if 0 /* These are for when linux supports these statistics */
1482 card_stats >>= 4; /* deferred */ 1480 card_stats >>= 4; /* deferred */
1483 card_stats >>= 4; /* excess deferred */ 1481 card_stats >>= 4; /* excess deferred */
@@ -1551,7 +1549,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id)
1551 if (status & IM_TX_EMPTY_INT) { 1549 if (status & IM_TX_EMPTY_INT) {
1552 outw(IM_TX_EMPTY_INT, ioaddr + INTERRUPT); 1550 outw(IM_TX_EMPTY_INT, ioaddr + INTERRUPT);
1553 mask &= ~IM_TX_EMPTY_INT; 1551 mask &= ~IM_TX_EMPTY_INT;
1554 smc->stats.tx_packets += smc->packets_waiting; 1552 dev->stats.tx_packets += smc->packets_waiting;
1555 smc->packets_waiting = 0; 1553 smc->packets_waiting = 0;
1556 } 1554 }
1557 if (status & IM_ALLOC_INT) { 1555 if (status & IM_ALLOC_INT) {
@@ -1567,8 +1565,8 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id)
1567 netif_wake_queue(dev); 1565 netif_wake_queue(dev);
1568 } 1566 }
1569 if (status & IM_RX_OVRN_INT) { 1567 if (status & IM_RX_OVRN_INT) {
1570 smc->stats.rx_errors++; 1568 dev->stats.rx_errors++;
1571 smc->stats.rx_fifo_errors++; 1569 dev->stats.rx_fifo_errors++;
1572 if (smc->duplex) 1570 if (smc->duplex)
1573 smc->rx_ovrn = 1; /* need MC_RESET outside smc_interrupt */ 1571 smc->rx_ovrn = 1; /* need MC_RESET outside smc_interrupt */
1574 outw(IM_RX_OVRN_INT, ioaddr + INTERRUPT); 1572 outw(IM_RX_OVRN_INT, ioaddr + INTERRUPT);
@@ -1618,7 +1616,6 @@ irq_done:
1618 1616
1619static void smc_rx(struct net_device *dev) 1617static void smc_rx(struct net_device *dev)
1620{ 1618{
1621 struct smc_private *smc = netdev_priv(dev);
1622 unsigned int ioaddr = dev->base_addr; 1619 unsigned int ioaddr = dev->base_addr;
1623 int rx_status; 1620 int rx_status;
1624 int packet_length; /* Caution: not frame length, rather words 1621 int packet_length; /* Caution: not frame length, rather words
@@ -1649,7 +1646,7 @@ static void smc_rx(struct net_device *dev)
1649 1646
1650 if (skb == NULL) { 1647 if (skb == NULL) {
1651 DEBUG(1, "%s: Low memory, packet dropped.\n", dev->name); 1648 DEBUG(1, "%s: Low memory, packet dropped.\n", dev->name);
1652 smc->stats.rx_dropped++; 1649 dev->stats.rx_dropped++;
1653 outw(MC_RELEASE, ioaddr + MMU_CMD); 1650 outw(MC_RELEASE, ioaddr + MMU_CMD);
1654 return; 1651 return;
1655 } 1652 }
@@ -1662,18 +1659,18 @@ static void smc_rx(struct net_device *dev)
1662 1659
1663 netif_rx(skb); 1660 netif_rx(skb);
1664 dev->last_rx = jiffies; 1661 dev->last_rx = jiffies;
1665 smc->stats.rx_packets++; 1662 dev->stats.rx_packets++;
1666 smc->stats.rx_bytes += packet_length; 1663 dev->stats.rx_bytes += packet_length;
1667 if (rx_status & RS_MULTICAST) 1664 if (rx_status & RS_MULTICAST)
1668 smc->stats.multicast++; 1665 dev->stats.multicast++;
1669 } else { 1666 } else {
1670 /* error ... */ 1667 /* error ... */
1671 smc->stats.rx_errors++; 1668 dev->stats.rx_errors++;
1672 1669
1673 if (rx_status & RS_ALGNERR) smc->stats.rx_frame_errors++; 1670 if (rx_status & RS_ALGNERR) dev->stats.rx_frame_errors++;
1674 if (rx_status & (RS_TOOSHORT | RS_TOOLONG)) 1671 if (rx_status & (RS_TOOSHORT | RS_TOOLONG))
1675 smc->stats.rx_length_errors++; 1672 dev->stats.rx_length_errors++;
1676 if (rx_status & RS_BADCRC) smc->stats.rx_crc_errors++; 1673 if (rx_status & RS_BADCRC) dev->stats.rx_crc_errors++;
1677 } 1674 }
1678 /* Let the MMU free the memory of this packet. */ 1675 /* Let the MMU free the memory of this packet. */
1679 outw(MC_RELEASE, ioaddr + MMU_CMD); 1676 outw(MC_RELEASE, ioaddr + MMU_CMD);
@@ -1681,15 +1678,6 @@ static void smc_rx(struct net_device *dev)
1681 return; 1678 return;
1682} 1679}
1683 1680
1684/*====================================================================*/
1685
1686static struct net_device_stats *smc_get_stats(struct net_device *dev)
1687{
1688 struct smc_private *smc = netdev_priv(dev);
1689 /* Nothing to update - the 91c92 is a pretty primative chip. */
1690 return &smc->stats;
1691}
1692
1693/*====================================================================== 1681/*======================================================================
1694 1682
1695 Calculate values for the hardware multicast filter hash table. 1683 Calculate values for the hardware multicast filter hash table.