aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ewrk3.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/ewrk3.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/ewrk3.c')
-rw-r--r--drivers/net/ewrk3.c37
1 files changed, 13 insertions, 24 deletions
diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c
index 6a5d0436e89e..142aa225d89e 100644
--- a/drivers/net/ewrk3.c
+++ b/drivers/net/ewrk3.c
@@ -275,7 +275,6 @@ struct ewrk3_private {
275 u_long shmem_base; /* Shared memory start address */ 275 u_long shmem_base; /* Shared memory start address */
276 void __iomem *shmem; 276 void __iomem *shmem;
277 u_long shmem_length; /* Shared memory window length */ 277 u_long shmem_length; /* Shared memory window length */
278 struct net_device_stats stats; /* Public stats */
279 struct ewrk3_stats pktStats; /* Private stats counters */ 278 struct ewrk3_stats pktStats; /* Private stats counters */
280 u_char irq_mask; /* Adapter IRQ mask bits */ 279 u_char irq_mask; /* Adapter IRQ mask bits */
281 u_char mPage; /* Maximum 2kB Page number */ 280 u_char mPage; /* Maximum 2kB Page number */
@@ -302,7 +301,6 @@ static int ewrk3_open(struct net_device *dev);
302static int ewrk3_queue_pkt(struct sk_buff *skb, struct net_device *dev); 301static int ewrk3_queue_pkt(struct sk_buff *skb, struct net_device *dev);
303static irqreturn_t ewrk3_interrupt(int irq, void *dev_id); 302static irqreturn_t ewrk3_interrupt(int irq, void *dev_id);
304static int ewrk3_close(struct net_device *dev); 303static int ewrk3_close(struct net_device *dev);
305static struct net_device_stats *ewrk3_get_stats(struct net_device *dev);
306static void set_multicast_list(struct net_device *dev); 304static void set_multicast_list(struct net_device *dev);
307static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 305static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
308static const struct ethtool_ops ethtool_ops_203; 306static const struct ethtool_ops ethtool_ops_203;
@@ -611,7 +609,6 @@ ewrk3_hw_init(struct net_device *dev, u_long iobase)
611 dev->open = ewrk3_open; 609 dev->open = ewrk3_open;
612 dev->hard_start_xmit = ewrk3_queue_pkt; 610 dev->hard_start_xmit = ewrk3_queue_pkt;
613 dev->stop = ewrk3_close; 611 dev->stop = ewrk3_close;
614 dev->get_stats = ewrk3_get_stats;
615 dev->set_multicast_list = set_multicast_list; 612 dev->set_multicast_list = set_multicast_list;
616 dev->do_ioctl = ewrk3_ioctl; 613 dev->do_ioctl = ewrk3_ioctl;
617 if (lp->adapter_name[4] == '3') 614 if (lp->adapter_name[4] == '3')
@@ -863,7 +860,7 @@ static int ewrk3_queue_pkt (struct sk_buff *skb, struct net_device *dev)
863 ENABLE_IRQs; 860 ENABLE_IRQs;
864 spin_unlock_irq (&lp->hw_lock); 861 spin_unlock_irq (&lp->hw_lock);
865 862
866 lp->stats.tx_bytes += skb->len; 863 dev->stats.tx_bytes += skb->len;
867 dev->trans_start = jiffies; 864 dev->trans_start = jiffies;
868 dev_kfree_skb (skb); 865 dev_kfree_skb (skb);
869 866
@@ -980,13 +977,13 @@ static int ewrk3_rx(struct net_device *dev)
980 } 977 }
981 978
982 if (!(rx_status & R_ROK)) { /* There was an error. */ 979 if (!(rx_status & R_ROK)) { /* There was an error. */
983 lp->stats.rx_errors++; /* Update the error stats. */ 980 dev->stats.rx_errors++; /* Update the error stats. */
984 if (rx_status & R_DBE) 981 if (rx_status & R_DBE)
985 lp->stats.rx_frame_errors++; 982 dev->stats.rx_frame_errors++;
986 if (rx_status & R_CRC) 983 if (rx_status & R_CRC)
987 lp->stats.rx_crc_errors++; 984 dev->stats.rx_crc_errors++;
988 if (rx_status & R_PLL) 985 if (rx_status & R_PLL)
989 lp->stats.rx_fifo_errors++; 986 dev->stats.rx_fifo_errors++;
990 } else { 987 } else {
991 struct sk_buff *skb; 988 struct sk_buff *skb;
992 989
@@ -1037,11 +1034,11 @@ static int ewrk3_rx(struct net_device *dev)
1037 ** Update stats 1034 ** Update stats
1038 */ 1035 */
1039 dev->last_rx = jiffies; 1036 dev->last_rx = jiffies;
1040 lp->stats.rx_packets++; 1037 dev->stats.rx_packets++;
1041 lp->stats.rx_bytes += pkt_len; 1038 dev->stats.rx_bytes += pkt_len;
1042 } else { 1039 } else {
1043 printk("%s: Insufficient memory; nuking packet.\n", dev->name); 1040 printk("%s: Insufficient memory; nuking packet.\n", dev->name);
1044 lp->stats.rx_dropped++; /* Really, deferred. */ 1041 dev->stats.rx_dropped++; /* Really, deferred. */
1045 break; 1042 break;
1046 } 1043 }
1047 } 1044 }
@@ -1071,11 +1068,11 @@ static int ewrk3_tx(struct net_device *dev)
1071 while ((tx_status = inb(EWRK3_TDQ)) > 0) { /* Whilst there's old buffers */ 1068 while ((tx_status = inb(EWRK3_TDQ)) > 0) { /* Whilst there's old buffers */
1072 if (tx_status & T_VSTS) { /* The status is valid */ 1069 if (tx_status & T_VSTS) { /* The status is valid */
1073 if (tx_status & T_TXE) { 1070 if (tx_status & T_TXE) {
1074 lp->stats.tx_errors++; 1071 dev->stats.tx_errors++;
1075 if (tx_status & T_NCL) 1072 if (tx_status & T_NCL)
1076 lp->stats.tx_carrier_errors++; 1073 dev->stats.tx_carrier_errors++;
1077 if (tx_status & T_LCL) 1074 if (tx_status & T_LCL)
1078 lp->stats.tx_window_errors++; 1075 dev->stats.tx_window_errors++;
1079 if (tx_status & T_CTU) { 1076 if (tx_status & T_CTU) {
1080 if ((tx_status & T_COLL) ^ T_XUR) { 1077 if ((tx_status & T_COLL) ^ T_XUR) {
1081 lp->pktStats.tx_underruns++; 1078 lp->pktStats.tx_underruns++;
@@ -1084,13 +1081,13 @@ static int ewrk3_tx(struct net_device *dev)
1084 } 1081 }
1085 } else if (tx_status & T_COLL) { 1082 } else if (tx_status & T_COLL) {
1086 if ((tx_status & T_COLL) ^ T_XCOLL) { 1083 if ((tx_status & T_COLL) ^ T_XCOLL) {
1087 lp->stats.collisions++; 1084 dev->stats.collisions++;
1088 } else { 1085 } else {
1089 lp->pktStats.excessive_collisions++; 1086 lp->pktStats.excessive_collisions++;
1090 } 1087 }
1091 } 1088 }
1092 } else { 1089 } else {
1093 lp->stats.tx_packets++; 1090 dev->stats.tx_packets++;
1094 } 1091 }
1095 } 1092 }
1096 } 1093 }
@@ -1133,14 +1130,6 @@ static int ewrk3_close(struct net_device *dev)
1133 return 0; 1130 return 0;
1134} 1131}
1135 1132
1136static struct net_device_stats *ewrk3_get_stats(struct net_device *dev)
1137{
1138 struct ewrk3_private *lp = netdev_priv(dev);
1139
1140 /* Null body since there is no framing error counter */
1141 return &lp->stats;
1142}
1143
1144/* 1133/*
1145 ** Set or clear the multicast filter for this adapter. 1134 ** Set or clear the multicast filter for this adapter.
1146 */ 1135 */