diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-10-03 20:41:50 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:16 -0400 |
commit | 09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (patch) | |
tree | 4c85b0b395abe7f88c87162fc22570e5de255cb1 /drivers/net/saa9730.c | |
parent | ff8ac60948ba819b89e9c87083e8050fc2f89999 (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/saa9730.c')
-rw-r--r-- | drivers/net/saa9730.c | 93 |
1 files changed, 42 insertions, 51 deletions
diff --git a/drivers/net/saa9730.c b/drivers/net/saa9730.c index 7dae4d404978..14361e885415 100644 --- a/drivers/net/saa9730.c +++ b/drivers/net/saa9730.c | |||
@@ -151,30 +151,30 @@ static void __attribute_used__ show_saa9730_regs(struct lan_saa9730_private *lp) | |||
151 | printk("lp->lan_saa9730_regs->CamData = %x\n", | 151 | printk("lp->lan_saa9730_regs->CamData = %x\n", |
152 | readl(&lp->lan_saa9730_regs->CamData)); | 152 | readl(&lp->lan_saa9730_regs->CamData)); |
153 | } | 153 | } |
154 | printk("lp->stats.tx_packets = %lx\n", lp->stats.tx_packets); | 154 | printk("dev->stats.tx_packets = %lx\n", dev->stats.tx_packets); |
155 | printk("lp->stats.tx_errors = %lx\n", lp->stats.tx_errors); | 155 | printk("dev->stats.tx_errors = %lx\n", dev->stats.tx_errors); |
156 | printk("lp->stats.tx_aborted_errors = %lx\n", | 156 | printk("dev->stats.tx_aborted_errors = %lx\n", |
157 | lp->stats.tx_aborted_errors); | 157 | dev->stats.tx_aborted_errors); |
158 | printk("lp->stats.tx_window_errors = %lx\n", | 158 | printk("dev->stats.tx_window_errors = %lx\n", |
159 | lp->stats.tx_window_errors); | 159 | dev->stats.tx_window_errors); |
160 | printk("lp->stats.tx_carrier_errors = %lx\n", | 160 | printk("dev->stats.tx_carrier_errors = %lx\n", |
161 | lp->stats.tx_carrier_errors); | 161 | dev->stats.tx_carrier_errors); |
162 | printk("lp->stats.tx_fifo_errors = %lx\n", | 162 | printk("dev->stats.tx_fifo_errors = %lx\n", |
163 | lp->stats.tx_fifo_errors); | 163 | dev->stats.tx_fifo_errors); |
164 | printk("lp->stats.tx_heartbeat_errors = %lx\n", | 164 | printk("dev->stats.tx_heartbeat_errors = %lx\n", |
165 | lp->stats.tx_heartbeat_errors); | 165 | dev->stats.tx_heartbeat_errors); |
166 | printk("lp->stats.collisions = %lx\n", lp->stats.collisions); | 166 | printk("dev->stats.collisions = %lx\n", dev->stats.collisions); |
167 | 167 | ||
168 | printk("lp->stats.rx_packets = %lx\n", lp->stats.rx_packets); | 168 | printk("dev->stats.rx_packets = %lx\n", dev->stats.rx_packets); |
169 | printk("lp->stats.rx_errors = %lx\n", lp->stats.rx_errors); | 169 | printk("dev->stats.rx_errors = %lx\n", dev->stats.rx_errors); |
170 | printk("lp->stats.rx_dropped = %lx\n", lp->stats.rx_dropped); | 170 | printk("dev->stats.rx_dropped = %lx\n", dev->stats.rx_dropped); |
171 | printk("lp->stats.rx_crc_errors = %lx\n", lp->stats.rx_crc_errors); | 171 | printk("dev->stats.rx_crc_errors = %lx\n", dev->stats.rx_crc_errors); |
172 | printk("lp->stats.rx_frame_errors = %lx\n", | 172 | printk("dev->stats.rx_frame_errors = %lx\n", |
173 | lp->stats.rx_frame_errors); | 173 | dev->stats.rx_frame_errors); |
174 | printk("lp->stats.rx_fifo_errors = %lx\n", | 174 | printk("dev->stats.rx_fifo_errors = %lx\n", |
175 | lp->stats.rx_fifo_errors); | 175 | dev->stats.rx_fifo_errors); |
176 | printk("lp->stats.rx_length_errors = %lx\n", | 176 | printk("dev->stats.rx_length_errors = %lx\n", |
177 | lp->stats.rx_length_errors); | 177 | dev->stats.rx_length_errors); |
178 | 178 | ||
179 | printk("lp->lan_saa9730_regs->DebugPCIMasterAddr = %x\n", | 179 | printk("lp->lan_saa9730_regs->DebugPCIMasterAddr = %x\n", |
180 | readl(&lp->lan_saa9730_regs->DebugPCIMasterAddr)); | 180 | readl(&lp->lan_saa9730_regs->DebugPCIMasterAddr)); |
@@ -605,24 +605,24 @@ static int lan_saa9730_tx(struct net_device *dev) | |||
605 | printk("lan_saa9730_tx: tx error = %x\n", | 605 | printk("lan_saa9730_tx: tx error = %x\n", |
606 | tx_status); | 606 | tx_status); |
607 | 607 | ||
608 | lp->stats.tx_errors++; | 608 | dev->stats.tx_errors++; |
609 | if (tx_status & | 609 | if (tx_status & |
610 | (TX_STATUS_EX_COLL << TX_STAT_CTL_STATUS_SHF)) | 610 | (TX_STATUS_EX_COLL << TX_STAT_CTL_STATUS_SHF)) |
611 | lp->stats.tx_aborted_errors++; | 611 | dev->stats.tx_aborted_errors++; |
612 | if (tx_status & | 612 | if (tx_status & |
613 | (TX_STATUS_LATE_COLL << TX_STAT_CTL_STATUS_SHF)) | 613 | (TX_STATUS_LATE_COLL << TX_STAT_CTL_STATUS_SHF)) |
614 | lp->stats.tx_window_errors++; | 614 | dev->stats.tx_window_errors++; |
615 | if (tx_status & | 615 | if (tx_status & |
616 | (TX_STATUS_L_CARR << TX_STAT_CTL_STATUS_SHF)) | 616 | (TX_STATUS_L_CARR << TX_STAT_CTL_STATUS_SHF)) |
617 | lp->stats.tx_carrier_errors++; | 617 | dev->stats.tx_carrier_errors++; |
618 | if (tx_status & | 618 | if (tx_status & |
619 | (TX_STATUS_UNDER << TX_STAT_CTL_STATUS_SHF)) | 619 | (TX_STATUS_UNDER << TX_STAT_CTL_STATUS_SHF)) |
620 | lp->stats.tx_fifo_errors++; | 620 | dev->stats.tx_fifo_errors++; |
621 | if (tx_status & | 621 | if (tx_status & |
622 | (TX_STATUS_SQ_ERR << TX_STAT_CTL_STATUS_SHF)) | 622 | (TX_STATUS_SQ_ERR << TX_STAT_CTL_STATUS_SHF)) |
623 | lp->stats.tx_heartbeat_errors++; | 623 | dev->stats.tx_heartbeat_errors++; |
624 | 624 | ||
625 | lp->stats.collisions += | 625 | dev->stats.collisions += |
626 | tx_status & TX_STATUS_TX_COLL_MSK; | 626 | tx_status & TX_STATUS_TX_COLL_MSK; |
627 | } | 627 | } |
628 | 628 | ||
@@ -684,10 +684,10 @@ static int lan_saa9730_rx(struct net_device *dev) | |||
684 | printk | 684 | printk |
685 | ("%s: Memory squeeze, deferring packet.\n", | 685 | ("%s: Memory squeeze, deferring packet.\n", |
686 | dev->name); | 686 | dev->name); |
687 | lp->stats.rx_dropped++; | 687 | dev->stats.rx_dropped++; |
688 | } else { | 688 | } else { |
689 | lp->stats.rx_bytes += len; | 689 | dev->stats.rx_bytes += len; |
690 | lp->stats.rx_packets++; | 690 | dev->stats.rx_packets++; |
691 | skb_reserve(skb, 2); /* 16 byte align */ | 691 | skb_reserve(skb, 2); /* 16 byte align */ |
692 | skb_put(skb, len); /* make room */ | 692 | skb_put(skb, len); /* make room */ |
693 | skb_copy_to_linear_data(skb, | 693 | skb_copy_to_linear_data(skb, |
@@ -704,19 +704,19 @@ static int lan_saa9730_rx(struct net_device *dev) | |||
704 | ("lan_saa9730_rx: We got an error packet = %x\n", | 704 | ("lan_saa9730_rx: We got an error packet = %x\n", |
705 | rx_status); | 705 | rx_status); |
706 | 706 | ||
707 | lp->stats.rx_errors++; | 707 | dev->stats.rx_errors++; |
708 | if (rx_status & | 708 | if (rx_status & |
709 | (RX_STATUS_CRC_ERR << RX_STAT_CTL_STATUS_SHF)) | 709 | (RX_STATUS_CRC_ERR << RX_STAT_CTL_STATUS_SHF)) |
710 | lp->stats.rx_crc_errors++; | 710 | dev->stats.rx_crc_errors++; |
711 | if (rx_status & | 711 | if (rx_status & |
712 | (RX_STATUS_ALIGN_ERR << RX_STAT_CTL_STATUS_SHF)) | 712 | (RX_STATUS_ALIGN_ERR << RX_STAT_CTL_STATUS_SHF)) |
713 | lp->stats.rx_frame_errors++; | 713 | dev->stats.rx_frame_errors++; |
714 | if (rx_status & | 714 | if (rx_status & |
715 | (RX_STATUS_OVERFLOW << RX_STAT_CTL_STATUS_SHF)) | 715 | (RX_STATUS_OVERFLOW << RX_STAT_CTL_STATUS_SHF)) |
716 | lp->stats.rx_fifo_errors++; | 716 | dev->stats.rx_fifo_errors++; |
717 | if (rx_status & | 717 | if (rx_status & |
718 | (RX_STATUS_LONG_ERR << RX_STAT_CTL_STATUS_SHF)) | 718 | (RX_STATUS_LONG_ERR << RX_STAT_CTL_STATUS_SHF)) |
719 | lp->stats.rx_length_errors++; | 719 | dev->stats.rx_length_errors++; |
720 | } | 720 | } |
721 | 721 | ||
722 | /* Indicate we have processed the buffer. */ | 722 | /* Indicate we have processed the buffer. */ |
@@ -853,7 +853,7 @@ static void lan_saa9730_tx_timeout(struct net_device *dev) | |||
853 | struct lan_saa9730_private *lp = netdev_priv(dev); | 853 | struct lan_saa9730_private *lp = netdev_priv(dev); |
854 | 854 | ||
855 | /* Transmitter timeout, serious problems */ | 855 | /* Transmitter timeout, serious problems */ |
856 | lp->stats.tx_errors++; | 856 | dev->stats.tx_errors++; |
857 | printk("%s: transmit timed out, reset\n", dev->name); | 857 | printk("%s: transmit timed out, reset\n", dev->name); |
858 | /*show_saa9730_regs(lp); */ | 858 | /*show_saa9730_regs(lp); */ |
859 | lan_saa9730_restart(lp); | 859 | lan_saa9730_restart(lp); |
@@ -886,8 +886,8 @@ static int lan_saa9730_start_xmit(struct sk_buff *skb, | |||
886 | return -1; | 886 | return -1; |
887 | } | 887 | } |
888 | 888 | ||
889 | lp->stats.tx_bytes += len; | 889 | dev->stats.tx_bytes += len; |
890 | lp->stats.tx_packets++; | 890 | dev->stats.tx_packets++; |
891 | 891 | ||
892 | dev->trans_start = jiffies; | 892 | dev->trans_start = jiffies; |
893 | netif_wake_queue(dev); | 893 | netif_wake_queue(dev); |
@@ -919,14 +919,6 @@ static int lan_saa9730_close(struct net_device *dev) | |||
919 | return 0; | 919 | return 0; |
920 | } | 920 | } |
921 | 921 | ||
922 | static struct net_device_stats *lan_saa9730_get_stats(struct net_device | ||
923 | *dev) | ||
924 | { | ||
925 | struct lan_saa9730_private *lp = netdev_priv(dev); | ||
926 | |||
927 | return &lp->stats; | ||
928 | } | ||
929 | |||
930 | static void lan_saa9730_set_multicast(struct net_device *dev) | 922 | static void lan_saa9730_set_multicast(struct net_device *dev) |
931 | { | 923 | { |
932 | struct lan_saa9730_private *lp = netdev_priv(dev); | 924 | struct lan_saa9730_private *lp = netdev_priv(dev); |
@@ -1040,7 +1032,6 @@ static int lan_saa9730_init(struct net_device *dev, struct pci_dev *pdev, | |||
1040 | dev->open = lan_saa9730_open; | 1032 | dev->open = lan_saa9730_open; |
1041 | dev->hard_start_xmit = lan_saa9730_start_xmit; | 1033 | dev->hard_start_xmit = lan_saa9730_start_xmit; |
1042 | dev->stop = lan_saa9730_close; | 1034 | dev->stop = lan_saa9730_close; |
1043 | dev->get_stats = lan_saa9730_get_stats; | ||
1044 | dev->set_multicast_list = lan_saa9730_set_multicast; | 1035 | dev->set_multicast_list = lan_saa9730_set_multicast; |
1045 | dev->tx_timeout = lan_saa9730_tx_timeout; | 1036 | dev->tx_timeout = lan_saa9730_tx_timeout; |
1046 | dev->watchdog_timeo = (HZ >> 1); | 1037 | dev->watchdog_timeo = (HZ >> 1); |