aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/seeq8005.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/seeq8005.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/seeq8005.c')
-rw-r--r--drivers/net/seeq8005.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c
index 4bce7c4f373c..8ef94028cba5 100644
--- a/drivers/net/seeq8005.c
+++ b/drivers/net/seeq8005.c
@@ -67,7 +67,6 @@ static unsigned int net_debug = NET_DEBUG;
67 67
68/* Information that need to be kept for each board. */ 68/* Information that need to be kept for each board. */
69struct net_local { 69struct net_local {
70 struct net_device_stats stats;
71 unsigned short receive_ptr; /* What address in packet memory do we expect a recv_pkt_header? */ 70 unsigned short receive_ptr; /* What address in packet memory do we expect a recv_pkt_header? */
72 long open_time; /* Useless example local info. */ 71 long open_time; /* Useless example local info. */
73}; 72};
@@ -86,7 +85,6 @@ static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev);
86static irqreturn_t seeq8005_interrupt(int irq, void *dev_id); 85static irqreturn_t seeq8005_interrupt(int irq, void *dev_id);
87static void seeq8005_rx(struct net_device *dev); 86static void seeq8005_rx(struct net_device *dev);
88static int seeq8005_close(struct net_device *dev); 87static int seeq8005_close(struct net_device *dev);
89static struct net_device_stats *seeq8005_get_stats(struct net_device *dev);
90static void set_multicast_list(struct net_device *dev); 88static void set_multicast_list(struct net_device *dev);
91 89
92/* Example routines you must write ;->. */ 90/* Example routines you must write ;->. */
@@ -338,7 +336,6 @@ static int __init seeq8005_probe1(struct net_device *dev, int ioaddr)
338 dev->hard_start_xmit = seeq8005_send_packet; 336 dev->hard_start_xmit = seeq8005_send_packet;
339 dev->tx_timeout = seeq8005_timeout; 337 dev->tx_timeout = seeq8005_timeout;
340 dev->watchdog_timeo = HZ/20; 338 dev->watchdog_timeo = HZ/20;
341 dev->get_stats = seeq8005_get_stats;
342 dev->set_multicast_list = set_multicast_list; 339 dev->set_multicast_list = set_multicast_list;
343 dev->flags &= ~IFF_MULTICAST; 340 dev->flags &= ~IFF_MULTICAST;
344 341
@@ -391,7 +388,6 @@ static void seeq8005_timeout(struct net_device *dev)
391 388
392static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev) 389static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev)
393{ 390{
394 struct net_local *lp = netdev_priv(dev);
395 short length = skb->len; 391 short length = skb->len;
396 unsigned char *buf; 392 unsigned char *buf;
397 393
@@ -407,7 +403,7 @@ static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev)
407 403
408 hardware_send_packet(dev, buf, length); 404 hardware_send_packet(dev, buf, length);
409 dev->trans_start = jiffies; 405 dev->trans_start = jiffies;
410 lp->stats.tx_bytes += length; 406 dev->stats.tx_bytes += length;
411 dev_kfree_skb (skb); 407 dev_kfree_skb (skb);
412 /* You might need to clean up and record Tx statistics here. */ 408 /* You might need to clean up and record Tx statistics here. */
413 409
@@ -463,7 +459,7 @@ static irqreturn_t seeq8005_interrupt(int irq, void *dev_id)
463 if (status & SEEQSTAT_TX_INT) { 459 if (status & SEEQSTAT_TX_INT) {
464 handled = 1; 460 handled = 1;
465 outw( SEEQCMD_TX_INT_ACK | (status & SEEQCMD_INT_MASK), SEEQ_CMD); 461 outw( SEEQCMD_TX_INT_ACK | (status & SEEQCMD_INT_MASK), SEEQ_CMD);
466 lp->stats.tx_packets++; 462 dev->stats.tx_packets++;
467 netif_wake_queue(dev); /* Inform upper layers. */ 463 netif_wake_queue(dev); /* Inform upper layers. */
468 } 464 }
469 if (status & SEEQSTAT_RX_INT) { 465 if (status & SEEQSTAT_RX_INT) {
@@ -531,11 +527,11 @@ static void seeq8005_rx(struct net_device *dev)
531 } 527 }
532 528
533 if (pkt_hdr & SEEQPKTS_ANY_ERROR) { /* There was an error. */ 529 if (pkt_hdr & SEEQPKTS_ANY_ERROR) { /* There was an error. */
534 lp->stats.rx_errors++; 530 dev->stats.rx_errors++;
535 if (pkt_hdr & SEEQPKTS_SHORT) lp->stats.rx_frame_errors++; 531 if (pkt_hdr & SEEQPKTS_SHORT) dev->stats.rx_frame_errors++;
536 if (pkt_hdr & SEEQPKTS_DRIB) lp->stats.rx_frame_errors++; 532 if (pkt_hdr & SEEQPKTS_DRIB) dev->stats.rx_frame_errors++;
537 if (pkt_hdr & SEEQPKTS_OVERSIZE) lp->stats.rx_over_errors++; 533 if (pkt_hdr & SEEQPKTS_OVERSIZE) dev->stats.rx_over_errors++;
538 if (pkt_hdr & SEEQPKTS_CRC_ERR) lp->stats.rx_crc_errors++; 534 if (pkt_hdr & SEEQPKTS_CRC_ERR) dev->stats.rx_crc_errors++;
539 /* skip over this packet */ 535 /* skip over this packet */
540 outw( SEEQCMD_FIFO_WRITE | SEEQCMD_DMA_INT_ACK | (status & SEEQCMD_INT_MASK), SEEQ_CMD); 536 outw( SEEQCMD_FIFO_WRITE | SEEQCMD_DMA_INT_ACK | (status & SEEQCMD_INT_MASK), SEEQ_CMD);
541 outw( (lp->receive_ptr & 0xff00)>>8, SEEQ_REA); 537 outw( (lp->receive_ptr & 0xff00)>>8, SEEQ_REA);
@@ -547,7 +543,7 @@ static void seeq8005_rx(struct net_device *dev)
547 skb = dev_alloc_skb(pkt_len); 543 skb = dev_alloc_skb(pkt_len);
548 if (skb == NULL) { 544 if (skb == NULL) {
549 printk("%s: Memory squeeze, dropping packet.\n", dev->name); 545 printk("%s: Memory squeeze, dropping packet.\n", dev->name);
550 lp->stats.rx_dropped++; 546 dev->stats.rx_dropped++;
551 break; 547 break;
552 } 548 }
553 skb_reserve(skb, 2); /* align data on 16 byte */ 549 skb_reserve(skb, 2); /* align data on 16 byte */
@@ -567,8 +563,8 @@ static void seeq8005_rx(struct net_device *dev)
567 skb->protocol=eth_type_trans(skb,dev); 563 skb->protocol=eth_type_trans(skb,dev);
568 netif_rx(skb); 564 netif_rx(skb);
569 dev->last_rx = jiffies; 565 dev->last_rx = jiffies;
570 lp->stats.rx_packets++; 566 dev->stats.rx_packets++;
571 lp->stats.rx_bytes += pkt_len; 567 dev->stats.rx_bytes += pkt_len;
572 } 568 }
573 } while ((--boguscount) && (pkt_hdr & SEEQPKTH_CHAIN)); 569 } while ((--boguscount) && (pkt_hdr & SEEQPKTH_CHAIN));
574 570
@@ -599,15 +595,6 @@ static int seeq8005_close(struct net_device *dev)
599 595
600} 596}
601 597
602/* Get the current statistics. This may be called with the card open or
603 closed. */
604static struct net_device_stats *seeq8005_get_stats(struct net_device *dev)
605{
606 struct net_local *lp = netdev_priv(dev);
607
608 return &lp->stats;
609}
610
611/* Set or clear the multicast filter for this adaptor. 598/* Set or clear the multicast filter for this adaptor.
612 num_addrs == -1 Promiscuous mode, receive all packets 599 num_addrs == -1 Promiscuous mode, receive all packets
613 num_addrs == 0 Normal mode, clear multicast list 600 num_addrs == 0 Normal mode, clear multicast list