aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2010-08-18 16:15:31 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-19 03:12:38 -0400
commitbb2537f1e76b3fb18c3fc1dff1df98ebc10af633 (patch)
tree7c74a9ededc35cbc5ce4446911da1e10ca1598a4 /drivers
parent25aec76a3bd962f0aae1d7980ab1efa56cb24b43 (diff)
ether3: Use net_device_stats from struct net_device
struct net_device has its own struct net_device_stats member, so use this one instead of a private copy in the ether1_priv struct. As the new ndo_get_stats function would just return dev->stats we can omit it. This patch also removes an incorrect memset of the stats on open. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/arm/ether3.c33
-rw-r--r--drivers/net/arm/ether3.h1
2 files changed, 10 insertions, 24 deletions
diff --git a/drivers/net/arm/ether3.c b/drivers/net/arm/ether3.c
index 1361b7367c28..44a8746f4014 100644
--- a/drivers/net/arm/ether3.c
+++ b/drivers/net/arm/ether3.c
@@ -81,7 +81,6 @@ static int ether3_open (struct net_device *dev);
81static int ether3_sendpacket (struct sk_buff *skb, struct net_device *dev); 81static int ether3_sendpacket (struct sk_buff *skb, struct net_device *dev);
82static irqreturn_t ether3_interrupt (int irq, void *dev_id); 82static irqreturn_t ether3_interrupt (int irq, void *dev_id);
83static int ether3_close (struct net_device *dev); 83static int ether3_close (struct net_device *dev);
84static struct net_device_stats *ether3_getstats (struct net_device *dev);
85static void ether3_setmulticastlist (struct net_device *dev); 84static void ether3_setmulticastlist (struct net_device *dev);
86static void ether3_timeout(struct net_device *dev); 85static void ether3_timeout(struct net_device *dev);
87 86
@@ -323,8 +322,6 @@ ether3_init_for_open(struct net_device *dev)
323{ 322{
324 int i; 323 int i;
325 324
326 memset(&priv(dev)->stats, 0, sizeof(struct net_device_stats));
327
328 /* Reset the chip */ 325 /* Reset the chip */
329 ether3_outw(CFG2_RESET, REG_CONFIG2); 326 ether3_outw(CFG2_RESET, REG_CONFIG2);
330 udelay(4); 327 udelay(4);
@@ -442,15 +439,6 @@ ether3_close(struct net_device *dev)
442} 439}
443 440
444/* 441/*
445 * Get the current statistics. This may be called with the card open or
446 * closed.
447 */
448static struct net_device_stats *ether3_getstats(struct net_device *dev)
449{
450 return &priv(dev)->stats;
451}
452
453/*
454 * Set or clear promiscuous/multicast mode filter for this adaptor. 442 * Set or clear promiscuous/multicast mode filter for this adaptor.
455 * 443 *
456 * We don't attempt any packet filtering. The card may have a SEEQ 8004 444 * We don't attempt any packet filtering. The card may have a SEEQ 8004
@@ -490,7 +478,7 @@ static void ether3_timeout(struct net_device *dev)
490 local_irq_restore(flags); 478 local_irq_restore(flags);
491 479
492 priv(dev)->regs.config2 |= CFG2_CTRLO; 480 priv(dev)->regs.config2 |= CFG2_CTRLO;
493 priv(dev)->stats.tx_errors += 1; 481 dev->stats.tx_errors += 1;
494 ether3_outw(priv(dev)->regs.config2, REG_CONFIG2); 482 ether3_outw(priv(dev)->regs.config2, REG_CONFIG2);
495 priv(dev)->tx_head = priv(dev)->tx_tail = 0; 483 priv(dev)->tx_head = priv(dev)->tx_tail = 0;
496 484
@@ -509,7 +497,7 @@ ether3_sendpacket(struct sk_buff *skb, struct net_device *dev)
509 497
510 if (priv(dev)->broken) { 498 if (priv(dev)->broken) {
511 dev_kfree_skb(skb); 499 dev_kfree_skb(skb);
512 priv(dev)->stats.tx_dropped ++; 500 dev->stats.tx_dropped++;
513 netif_start_queue(dev); 501 netif_start_queue(dev);
514 return NETDEV_TX_OK; 502 return NETDEV_TX_OK;
515 } 503 }
@@ -673,7 +661,7 @@ if (next_ptr < RX_START || next_ptr >= RX_END) {
673 } else 661 } else
674 goto dropping; 662 goto dropping;
675 } else { 663 } else {
676 struct net_device_stats *stats = &priv(dev)->stats; 664 struct net_device_stats *stats = &dev->stats;
677 ether3_outw(next_ptr >> 8, REG_RECVEND); 665 ether3_outw(next_ptr >> 8, REG_RECVEND);
678 if (status & RXSTAT_OVERSIZE) stats->rx_over_errors ++; 666 if (status & RXSTAT_OVERSIZE) stats->rx_over_errors ++;
679 if (status & RXSTAT_CRCERROR) stats->rx_crc_errors ++; 667 if (status & RXSTAT_CRCERROR) stats->rx_crc_errors ++;
@@ -685,14 +673,14 @@ if (next_ptr < RX_START || next_ptr >= RX_END) {
685 while (-- maxcnt); 673 while (-- maxcnt);
686 674
687done: 675done:
688 priv(dev)->stats.rx_packets += received; 676 dev->stats.rx_packets += received;
689 priv(dev)->rx_head = next_ptr; 677 priv(dev)->rx_head = next_ptr;
690 /* 678 /*
691 * If rx went off line, then that means that the buffer may be full. We 679 * If rx went off line, then that means that the buffer may be full. We
692 * have dropped at least one packet. 680 * have dropped at least one packet.
693 */ 681 */
694 if (!(ether3_inw(REG_STATUS) & STAT_RXON)) { 682 if (!(ether3_inw(REG_STATUS) & STAT_RXON)) {
695 priv(dev)->stats.rx_dropped ++; 683 dev->stats.rx_dropped++;
696 ether3_outw(next_ptr, REG_RECVPTR); 684 ether3_outw(next_ptr, REG_RECVPTR);
697 ether3_outw(priv(dev)->regs.command | CMD_RXON, REG_COMMAND); 685 ether3_outw(priv(dev)->regs.command | CMD_RXON, REG_COMMAND);
698 } 686 }
@@ -710,7 +698,7 @@ dropping:{
710 last_warned = jiffies; 698 last_warned = jiffies;
711 printk("%s: memory squeeze, dropping packet.\n", dev->name); 699 printk("%s: memory squeeze, dropping packet.\n", dev->name);
712 } 700 }
713 priv(dev)->stats.rx_dropped ++; 701 dev->stats.rx_dropped++;
714 goto done; 702 goto done;
715 } 703 }
716} 704}
@@ -743,13 +731,13 @@ static void ether3_tx(struct net_device *dev)
743 * Update errors 731 * Update errors
744 */ 732 */
745 if (!(status & (TXSTAT_BABBLED | TXSTAT_16COLLISIONS))) 733 if (!(status & (TXSTAT_BABBLED | TXSTAT_16COLLISIONS)))
746 priv(dev)->stats.tx_packets++; 734 dev->stats.tx_packets++;
747 else { 735 else {
748 priv(dev)->stats.tx_errors ++; 736 dev->stats.tx_errors++;
749 if (status & TXSTAT_16COLLISIONS) 737 if (status & TXSTAT_16COLLISIONS)
750 priv(dev)->stats.collisions += 16; 738 dev->stats.collisions += 16;
751 if (status & TXSTAT_BABBLED) 739 if (status & TXSTAT_BABBLED)
752 priv(dev)->stats.tx_fifo_errors ++; 740 dev->stats.tx_fifo_errors++;
753 } 741 }
754 742
755 tx_tail = (tx_tail + 1) & 15; 743 tx_tail = (tx_tail + 1) & 15;
@@ -773,7 +761,6 @@ static const struct net_device_ops ether3_netdev_ops = {
773 .ndo_open = ether3_open, 761 .ndo_open = ether3_open,
774 .ndo_stop = ether3_close, 762 .ndo_stop = ether3_close,
775 .ndo_start_xmit = ether3_sendpacket, 763 .ndo_start_xmit = ether3_sendpacket,
776 .ndo_get_stats = ether3_getstats,
777 .ndo_set_multicast_list = ether3_setmulticastlist, 764 .ndo_set_multicast_list = ether3_setmulticastlist,
778 .ndo_tx_timeout = ether3_timeout, 765 .ndo_tx_timeout = ether3_timeout,
779 .ndo_validate_addr = eth_validate_addr, 766 .ndo_validate_addr = eth_validate_addr,
diff --git a/drivers/net/arm/ether3.h b/drivers/net/arm/ether3.h
index 1921a3a07da7..2db63b08bdf3 100644
--- a/drivers/net/arm/ether3.h
+++ b/drivers/net/arm/ether3.h
@@ -164,7 +164,6 @@ struct dev_priv {
164 unsigned char tx_head; /* buffer nr to insert next packet */ 164 unsigned char tx_head; /* buffer nr to insert next packet */
165 unsigned char tx_tail; /* buffer nr of transmitting packet */ 165 unsigned char tx_tail; /* buffer nr of transmitting packet */
166 unsigned int rx_head; /* address to fetch next packet from */ 166 unsigned int rx_head; /* address to fetch next packet from */
167 struct net_device_stats stats;
168 struct timer_list timer; 167 struct timer_list timer;
169 int broken; /* 0 = ok, 1 = something went wrong */ 168 int broken; /* 0 = ok, 1 = something went wrong */
170}; 169};