aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/eexpress.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-03 20:41:50 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:16 -0400
commit09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (patch)
tree4c85b0b395abe7f88c87162fc22570e5de255cb1 /drivers/net/eexpress.c
parentff8ac60948ba819b89e9c87083e8050fc2f89999 (diff)
[NET] drivers/net: statistics cleanup #1 -- save memory and shrink code
We now have struct net_device_stats embedded in struct net_device, and the default ->get_stats() hook does the obvious thing for us. Run through drivers/net/* and remove the driver-local storage of statistics, and driver-local ->get_stats() hook where applicable. This was just the low-hanging fruit in drivers/net; plenty more drivers remain to be updated. [ Resolved conflicts with napi_struct changes and fix sunqe build regression... -DaveM ] Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/eexpress.c')
-rw-r--r--drivers/net/eexpress.c56
1 files changed, 21 insertions, 35 deletions
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c
index 6c91bfa72bb2..9c85e50014b4 100644
--- a/drivers/net/eexpress.c
+++ b/drivers/net/eexpress.c
@@ -135,7 +135,6 @@
135 135
136struct net_local 136struct net_local
137{ 137{
138 struct net_device_stats stats;
139 unsigned long last_tx; /* jiffies when last transmit started */ 138 unsigned long last_tx; /* jiffies when last transmit started */
140 unsigned long init_time; /* jiffies when eexp_hw_init586 called */ 139 unsigned long init_time; /* jiffies when eexp_hw_init586 called */
141 unsigned short rx_first; /* first rx buf, same as RX_BUF_START */ 140 unsigned short rx_first; /* first rx buf, same as RX_BUF_START */
@@ -247,7 +246,6 @@ static char mca_irqmap[] = { 12, 9, 3, 4, 5, 10, 11, 15 };
247static int eexp_open(struct net_device *dev); 246static int eexp_open(struct net_device *dev);
248static int eexp_close(struct net_device *dev); 247static int eexp_close(struct net_device *dev);
249static void eexp_timeout(struct net_device *dev); 248static void eexp_timeout(struct net_device *dev);
250static struct net_device_stats *eexp_stats(struct net_device *dev);
251static int eexp_xmit(struct sk_buff *buf, struct net_device *dev); 249static int eexp_xmit(struct sk_buff *buf, struct net_device *dev);
252 250
253static irqreturn_t eexp_irq(int irq, void *dev_addr); 251static irqreturn_t eexp_irq(int irq, void *dev_addr);
@@ -533,17 +531,6 @@ static int eexp_close(struct net_device *dev)
533} 531}
534 532
535/* 533/*
536 * Return interface stats
537 */
538
539static struct net_device_stats *eexp_stats(struct net_device *dev)
540{
541 struct net_local *lp = netdev_priv(dev);
542
543 return &lp->stats;
544}
545
546/*
547 * This gets called when a higher level thinks we are broken. Check that 534 * This gets called when a higher level thinks we are broken. Check that
548 * nothing has become jammed in the CU. 535 * nothing has become jammed in the CU.
549 */ 536 */
@@ -646,7 +633,7 @@ static void eexp_timeout(struct net_device *dev)
646 printk(KERN_INFO "%s: transmit timed out, %s?\n", dev->name, 633 printk(KERN_INFO "%s: transmit timed out, %s?\n", dev->name,
647 (SCB_complete(status)?"lost interrupt": 634 (SCB_complete(status)?"lost interrupt":
648 "board on fire")); 635 "board on fire"));
649 lp->stats.tx_errors++; 636 dev->stats.tx_errors++;
650 lp->last_tx = jiffies; 637 lp->last_tx = jiffies;
651 if (!SCB_complete(status)) { 638 if (!SCB_complete(status)) {
652 scb_command(dev, SCB_CUabort); 639 scb_command(dev, SCB_CUabort);
@@ -694,7 +681,7 @@ static int eexp_xmit(struct sk_buff *buf, struct net_device *dev)
694 { 681 {
695 unsigned short *data = (unsigned short *)buf->data; 682 unsigned short *data = (unsigned short *)buf->data;
696 683
697 lp->stats.tx_bytes += length; 684 dev->stats.tx_bytes += length;
698 685
699 eexp_hw_tx_pio(dev,data,length); 686 eexp_hw_tx_pio(dev,data,length);
700 } 687 }
@@ -843,7 +830,7 @@ static irqreturn_t eexp_irq(int irq, void *dev_info)
843 outw(rbd+8, ioaddr+READ_PTR); 830 outw(rbd+8, ioaddr+READ_PTR);
844 printk("[%04x]\n", inw(ioaddr+DATAPORT)); 831 printk("[%04x]\n", inw(ioaddr+DATAPORT));
845#endif 832#endif
846 lp->stats.rx_errors++; 833 dev->stats.rx_errors++;
847#if 1 834#if 1
848 eexp_hw_rxinit(dev); 835 eexp_hw_rxinit(dev);
849#else 836#else
@@ -952,17 +939,17 @@ static void eexp_hw_rx_pio(struct net_device *dev)
952 } 939 }
953 else if (!FD_OK(status)) 940 else if (!FD_OK(status))
954 { 941 {
955 lp->stats.rx_errors++; 942 dev->stats.rx_errors++;
956 if (FD_CRC(status)) 943 if (FD_CRC(status))
957 lp->stats.rx_crc_errors++; 944 dev->stats.rx_crc_errors++;
958 if (FD_Align(status)) 945 if (FD_Align(status))
959 lp->stats.rx_frame_errors++; 946 dev->stats.rx_frame_errors++;
960 if (FD_Resrc(status)) 947 if (FD_Resrc(status))
961 lp->stats.rx_fifo_errors++; 948 dev->stats.rx_fifo_errors++;
962 if (FD_DMA(status)) 949 if (FD_DMA(status))
963 lp->stats.rx_over_errors++; 950 dev->stats.rx_over_errors++;
964 if (FD_Short(status)) 951 if (FD_Short(status))
965 lp->stats.rx_length_errors++; 952 dev->stats.rx_length_errors++;
966 } 953 }
967 else 954 else
968 { 955 {
@@ -972,7 +959,7 @@ static void eexp_hw_rx_pio(struct net_device *dev)
972 if (skb == NULL) 959 if (skb == NULL)
973 { 960 {
974 printk(KERN_WARNING "%s: Memory squeeze, dropping packet\n",dev->name); 961 printk(KERN_WARNING "%s: Memory squeeze, dropping packet\n",dev->name);
975 lp->stats.rx_dropped++; 962 dev->stats.rx_dropped++;
976 break; 963 break;
977 } 964 }
978 skb_reserve(skb, 2); 965 skb_reserve(skb, 2);
@@ -981,8 +968,8 @@ static void eexp_hw_rx_pio(struct net_device *dev)
981 skb->protocol = eth_type_trans(skb,dev); 968 skb->protocol = eth_type_trans(skb,dev);
982 netif_rx(skb); 969 netif_rx(skb);
983 dev->last_rx = jiffies; 970 dev->last_rx = jiffies;
984 lp->stats.rx_packets++; 971 dev->stats.rx_packets++;
985 lp->stats.rx_bytes += pkt_len; 972 dev->stats.rx_bytes += pkt_len;
986 } 973 }
987 outw(rx_block, ioaddr+WRITE_PTR); 974 outw(rx_block, ioaddr+WRITE_PTR);
988 outw(0, ioaddr+DATAPORT); 975 outw(0, ioaddr+DATAPORT);
@@ -1053,7 +1040,7 @@ static void eexp_hw_tx_pio(struct net_device *dev, unsigned short *buf,
1053 outw(0xFFFF, ioaddr+SIGNAL_CA); 1040 outw(0xFFFF, ioaddr+SIGNAL_CA);
1054 } 1041 }
1055 1042
1056 lp->stats.tx_packets++; 1043 dev->stats.tx_packets++;
1057 lp->last_tx = jiffies; 1044 lp->last_tx = jiffies;
1058} 1045}
1059 1046
@@ -1180,7 +1167,6 @@ static int __init eexp_hw_probe(struct net_device *dev, unsigned short ioaddr)
1180 dev->open = eexp_open; 1167 dev->open = eexp_open;
1181 dev->stop = eexp_close; 1168 dev->stop = eexp_close;
1182 dev->hard_start_xmit = eexp_xmit; 1169 dev->hard_start_xmit = eexp_xmit;
1183 dev->get_stats = eexp_stats;
1184 dev->set_multicast_list = &eexp_set_multicast; 1170 dev->set_multicast_list = &eexp_set_multicast;
1185 dev->tx_timeout = eexp_timeout; 1171 dev->tx_timeout = eexp_timeout;
1186 dev->watchdog_timeo = 2*HZ; 1172 dev->watchdog_timeo = 2*HZ;
@@ -1263,35 +1249,35 @@ static unsigned short eexp_hw_lasttxstat(struct net_device *dev)
1263 else 1249 else
1264 { 1250 {
1265 lp->last_tx_restart = 0; 1251 lp->last_tx_restart = 0;
1266 lp->stats.collisions += Stat_NoColl(status); 1252 dev->stats.collisions += Stat_NoColl(status);
1267 if (!Stat_OK(status)) 1253 if (!Stat_OK(status))
1268 { 1254 {
1269 char *whatsup = NULL; 1255 char *whatsup = NULL;
1270 lp->stats.tx_errors++; 1256 dev->stats.tx_errors++;
1271 if (Stat_Abort(status)) 1257 if (Stat_Abort(status))
1272 lp->stats.tx_aborted_errors++; 1258 dev->stats.tx_aborted_errors++;
1273 if (Stat_TNoCar(status)) { 1259 if (Stat_TNoCar(status)) {
1274 whatsup = "aborted, no carrier"; 1260 whatsup = "aborted, no carrier";
1275 lp->stats.tx_carrier_errors++; 1261 dev->stats.tx_carrier_errors++;
1276 } 1262 }
1277 if (Stat_TNoCTS(status)) { 1263 if (Stat_TNoCTS(status)) {
1278 whatsup = "aborted, lost CTS"; 1264 whatsup = "aborted, lost CTS";
1279 lp->stats.tx_carrier_errors++; 1265 dev->stats.tx_carrier_errors++;
1280 } 1266 }
1281 if (Stat_TNoDMA(status)) { 1267 if (Stat_TNoDMA(status)) {
1282 whatsup = "FIFO underran"; 1268 whatsup = "FIFO underran";
1283 lp->stats.tx_fifo_errors++; 1269 dev->stats.tx_fifo_errors++;
1284 } 1270 }
1285 if (Stat_TXColl(status)) { 1271 if (Stat_TXColl(status)) {
1286 whatsup = "aborted, too many collisions"; 1272 whatsup = "aborted, too many collisions";
1287 lp->stats.tx_aborted_errors++; 1273 dev->stats.tx_aborted_errors++;
1288 } 1274 }
1289 if (whatsup) 1275 if (whatsup)
1290 printk(KERN_INFO "%s: transmit %s\n", 1276 printk(KERN_INFO "%s: transmit %s\n",
1291 dev->name, whatsup); 1277 dev->name, whatsup);
1292 } 1278 }
1293 else 1279 else
1294 lp->stats.tx_packets++; 1280 dev->stats.tx_packets++;
1295 } 1281 }
1296 if (tx_block == TX_BUF_START+((lp->num_tx_bufs-1)*TX_BUF_SIZE)) 1282 if (tx_block == TX_BUF_START+((lp->num_tx_bufs-1)*TX_BUF_SIZE))
1297 lp->tx_reap = tx_block = TX_BUF_START; 1283 lp->tx_reap = tx_block = TX_BUF_START;