aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/smc911x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/smc911x.c')
-rw-r--r--drivers/net/smc911x.c77
1 files changed, 28 insertions, 49 deletions
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 5f03e44ad135..c0276c04dece 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -115,13 +115,6 @@ struct smc911x_local {
115 */ 115 */
116 struct sk_buff *pending_tx_skb; 116 struct sk_buff *pending_tx_skb;
117 117
118 /*
119 * these are things that the kernel wants me to keep, so users
120 * can find out semi-useless statistics of how well the card is
121 * performing
122 */
123 struct net_device_stats stats;
124
125 /* version/revision of the SMC911x chip */ 118 /* version/revision of the SMC911x chip */
126 u16 version; 119 u16 version;
127 u16 revision; 120 u16 revision;
@@ -315,8 +308,8 @@ static void smc911x_reset(struct net_device *dev)
315 if (lp->pending_tx_skb != NULL) { 308 if (lp->pending_tx_skb != NULL) {
316 dev_kfree_skb (lp->pending_tx_skb); 309 dev_kfree_skb (lp->pending_tx_skb);
317 lp->pending_tx_skb = NULL; 310 lp->pending_tx_skb = NULL;
318 lp->stats.tx_errors++; 311 dev->stats.tx_errors++;
319 lp->stats.tx_aborted_errors++; 312 dev->stats.tx_aborted_errors++;
320 } 313 }
321} 314}
322 315
@@ -449,14 +442,14 @@ static inline void smc911x_rcv(struct net_device *dev)
449 pkt_len = (status & RX_STS_PKT_LEN_) >> 16; 442 pkt_len = (status & RX_STS_PKT_LEN_) >> 16;
450 if (status & RX_STS_ES_) { 443 if (status & RX_STS_ES_) {
451 /* Deal with a bad packet */ 444 /* Deal with a bad packet */
452 lp->stats.rx_errors++; 445 dev->stats.rx_errors++;
453 if (status & RX_STS_CRC_ERR_) 446 if (status & RX_STS_CRC_ERR_)
454 lp->stats.rx_crc_errors++; 447 dev->stats.rx_crc_errors++;
455 else { 448 else {
456 if (status & RX_STS_LEN_ERR_) 449 if (status & RX_STS_LEN_ERR_)
457 lp->stats.rx_length_errors++; 450 dev->stats.rx_length_errors++;
458 if (status & RX_STS_MCAST_) 451 if (status & RX_STS_MCAST_)
459 lp->stats.multicast++; 452 dev->stats.multicast++;
460 } 453 }
461 /* Remove the bad packet data from the RX FIFO */ 454 /* Remove the bad packet data from the RX FIFO */
462 smc911x_drop_pkt(dev); 455 smc911x_drop_pkt(dev);
@@ -467,7 +460,7 @@ static inline void smc911x_rcv(struct net_device *dev)
467 if (unlikely(skb == NULL)) { 460 if (unlikely(skb == NULL)) {
468 PRINTK( "%s: Low memory, rcvd packet dropped.\n", 461 PRINTK( "%s: Low memory, rcvd packet dropped.\n",
469 dev->name); 462 dev->name);
470 lp->stats.rx_dropped++; 463 dev->stats.rx_dropped++;
471 smc911x_drop_pkt(dev); 464 smc911x_drop_pkt(dev);
472 return; 465 return;
473 } 466 }
@@ -503,8 +496,8 @@ static inline void smc911x_rcv(struct net_device *dev)
503 dev->last_rx = jiffies; 496 dev->last_rx = jiffies;
504 skb->protocol = eth_type_trans(skb, dev); 497 skb->protocol = eth_type_trans(skb, dev);
505 netif_rx(skb); 498 netif_rx(skb);
506 lp->stats.rx_packets++; 499 dev->stats.rx_packets++;
507 lp->stats.rx_bytes += pkt_len-4; 500 dev->stats.rx_bytes += pkt_len-4;
508#endif 501#endif
509 } 502 }
510} 503}
@@ -616,8 +609,8 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
616 printk("%s: No Tx free space %d < %d\n", 609 printk("%s: No Tx free space %d < %d\n",
617 dev->name, free, skb->len); 610 dev->name, free, skb->len);
618 lp->pending_tx_skb = NULL; 611 lp->pending_tx_skb = NULL;
619 lp->stats.tx_errors++; 612 dev->stats.tx_errors++;
620 lp->stats.tx_dropped++; 613 dev->stats.tx_dropped++;
621 dev_kfree_skb(skb); 614 dev_kfree_skb(skb);
622 return 0; 615 return 0;
623 } 616 }
@@ -667,8 +660,8 @@ static void smc911x_tx(struct net_device *dev)
667 dev->name, 660 dev->name,
668 (SMC_GET_TX_FIFO_INF() & TX_FIFO_INF_TSUSED_) >> 16); 661 (SMC_GET_TX_FIFO_INF() & TX_FIFO_INF_TSUSED_) >> 16);
669 tx_status = SMC_GET_TX_STS_FIFO(); 662 tx_status = SMC_GET_TX_STS_FIFO();
670 lp->stats.tx_packets++; 663 dev->stats.tx_packets++;
671 lp->stats.tx_bytes+=tx_status>>16; 664 dev->stats.tx_bytes+=tx_status>>16;
672 DBG(SMC_DEBUG_TX, "%s: Tx FIFO tag 0x%04x status 0x%04x\n", 665 DBG(SMC_DEBUG_TX, "%s: Tx FIFO tag 0x%04x status 0x%04x\n",
673 dev->name, (tx_status & 0xffff0000) >> 16, 666 dev->name, (tx_status & 0xffff0000) >> 16,
674 tx_status & 0x0000ffff); 667 tx_status & 0x0000ffff);
@@ -676,22 +669,22 @@ static void smc911x_tx(struct net_device *dev)
676 * full-duplex mode */ 669 * full-duplex mode */
677 if ((tx_status & TX_STS_ES_) && !(lp->ctl_rfduplx && 670 if ((tx_status & TX_STS_ES_) && !(lp->ctl_rfduplx &&
678 !(tx_status & 0x00000306))) { 671 !(tx_status & 0x00000306))) {
679 lp->stats.tx_errors++; 672 dev->stats.tx_errors++;
680 } 673 }
681 if (tx_status & TX_STS_MANY_COLL_) { 674 if (tx_status & TX_STS_MANY_COLL_) {
682 lp->stats.collisions+=16; 675 dev->stats.collisions+=16;
683 lp->stats.tx_aborted_errors++; 676 dev->stats.tx_aborted_errors++;
684 } else { 677 } else {
685 lp->stats.collisions+=(tx_status & TX_STS_COLL_CNT_) >> 3; 678 dev->stats.collisions+=(tx_status & TX_STS_COLL_CNT_) >> 3;
686 } 679 }
687 /* carrier error only has meaning for half-duplex communication */ 680 /* carrier error only has meaning for half-duplex communication */
688 if ((tx_status & (TX_STS_LOC_ | TX_STS_NO_CARR_)) && 681 if ((tx_status & (TX_STS_LOC_ | TX_STS_NO_CARR_)) &&
689 !lp->ctl_rfduplx) { 682 !lp->ctl_rfduplx) {
690 lp->stats.tx_carrier_errors++; 683 dev->stats.tx_carrier_errors++;
691 } 684 }
692 if (tx_status & TX_STS_LATE_COLL_) { 685 if (tx_status & TX_STS_LATE_COLL_) {
693 lp->stats.collisions++; 686 dev->stats.collisions++;
694 lp->stats.tx_aborted_errors++; 687 dev->stats.tx_aborted_errors++;
695 } 688 }
696 } 689 }
697} 690}
@@ -1121,11 +1114,11 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id)
1121 /* Handle various error conditions */ 1114 /* Handle various error conditions */
1122 if (status & INT_STS_RXE_) { 1115 if (status & INT_STS_RXE_) {
1123 SMC_ACK_INT(INT_STS_RXE_); 1116 SMC_ACK_INT(INT_STS_RXE_);
1124 lp->stats.rx_errors++; 1117 dev->stats.rx_errors++;
1125 } 1118 }
1126 if (status & INT_STS_RXDFH_INT_) { 1119 if (status & INT_STS_RXDFH_INT_) {
1127 SMC_ACK_INT(INT_STS_RXDFH_INT_); 1120 SMC_ACK_INT(INT_STS_RXDFH_INT_);
1128 lp->stats.rx_dropped+=SMC_GET_RX_DROP(); 1121 dev->stats.rx_dropped+=SMC_GET_RX_DROP();
1129 } 1122 }
1130 /* Undocumented interrupt-what is the right thing to do here? */ 1123 /* Undocumented interrupt-what is the right thing to do here? */
1131 if (status & INT_STS_RXDF_INT_) { 1124 if (status & INT_STS_RXDF_INT_) {
@@ -1140,8 +1133,8 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id)
1140 cr &= ~MAC_CR_RXEN_; 1133 cr &= ~MAC_CR_RXEN_;
1141 SMC_SET_MAC_CR(cr); 1134 SMC_SET_MAC_CR(cr);
1142 DBG(SMC_DEBUG_RX, "%s: RX overrun\n", dev->name); 1135 DBG(SMC_DEBUG_RX, "%s: RX overrun\n", dev->name);
1143 lp->stats.rx_errors++; 1136 dev->stats.rx_errors++;
1144 lp->stats.rx_fifo_errors++; 1137 dev->stats.rx_fifo_errors++;
1145 } 1138 }
1146 SMC_ACK_INT(INT_STS_RDFL_); 1139 SMC_ACK_INT(INT_STS_RDFL_);
1147 } 1140 }
@@ -1152,8 +1145,8 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id)
1152 SMC_SET_MAC_CR(cr); 1145 SMC_SET_MAC_CR(cr);
1153 rx_overrun=1; 1146 rx_overrun=1;
1154 DBG(SMC_DEBUG_RX, "%s: RX overrun\n", dev->name); 1147 DBG(SMC_DEBUG_RX, "%s: RX overrun\n", dev->name);
1155 lp->stats.rx_errors++; 1148 dev->stats.rx_errors++;
1156 lp->stats.rx_fifo_errors++; 1149 dev->stats.rx_fifo_errors++;
1157 } 1150 }
1158 SMC_ACK_INT(INT_STS_RDFO_); 1151 SMC_ACK_INT(INT_STS_RDFO_);
1159 } 1152 }
@@ -1307,8 +1300,8 @@ smc911x_rx_dma_irq(int dma, void *data)
1307 dev->last_rx = jiffies; 1300 dev->last_rx = jiffies;
1308 skb->protocol = eth_type_trans(skb, dev); 1301 skb->protocol = eth_type_trans(skb, dev);
1309 netif_rx(skb); 1302 netif_rx(skb);
1310 lp->stats.rx_packets++; 1303 dev->stats.rx_packets++;
1311 lp->stats.rx_bytes += skb->len; 1304 dev->stats.rx_bytes += skb->len;
1312 1305
1313 spin_lock_irqsave(&lp->lock, flags); 1306 spin_lock_irqsave(&lp->lock, flags);
1314 pkts = (SMC_GET_RX_FIFO_INF() & RX_FIFO_INF_RXSUSED_) >> 16; 1307 pkts = (SMC_GET_RX_FIFO_INF() & RX_FIFO_INF_RXSUSED_) >> 16;
@@ -1568,19 +1561,6 @@ static int smc911x_close(struct net_device *dev)
1568} 1561}
1569 1562
1570/* 1563/*
1571 * Get the current statistics.
1572 * This may be called with the card open or closed.
1573 */
1574static struct net_device_stats *smc911x_query_statistics(struct net_device *dev)
1575{
1576 struct smc911x_local *lp = netdev_priv(dev);
1577 DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__);
1578
1579
1580 return &lp->stats;
1581}
1582
1583/*
1584 * Ethtool support 1564 * Ethtool support
1585 */ 1565 */
1586static int 1566static int
@@ -2056,7 +2036,6 @@ static int __init smc911x_probe(struct net_device *dev, unsigned long ioaddr)
2056 dev->hard_start_xmit = smc911x_hard_start_xmit; 2036 dev->hard_start_xmit = smc911x_hard_start_xmit;
2057 dev->tx_timeout = smc911x_timeout; 2037 dev->tx_timeout = smc911x_timeout;
2058 dev->watchdog_timeo = msecs_to_jiffies(watchdog); 2038 dev->watchdog_timeo = msecs_to_jiffies(watchdog);
2059 dev->get_stats = smc911x_query_statistics;
2060 dev->set_multicast_list = smc911x_set_multicast_list; 2039 dev->set_multicast_list = smc911x_set_multicast_list;
2061 dev->ethtool_ops = &smc911x_ethtool_ops; 2040 dev->ethtool_ops = &smc911x_ethtool_ops;
2062#ifdef CONFIG_NET_POLL_CONTROLLER 2041#ifdef CONFIG_NET_POLL_CONTROLLER