aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/au1000_eth.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/au1000_eth.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/au1000_eth.c')
-rw-r--r--drivers/net/au1000_eth.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index e86b3691765b..b46c5d8a77bd 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -90,7 +90,6 @@ static int au1000_rx(struct net_device *);
90static irqreturn_t au1000_interrupt(int, void *); 90static irqreturn_t au1000_interrupt(int, void *);
91static void au1000_tx_timeout(struct net_device *); 91static void au1000_tx_timeout(struct net_device *);
92static void set_rx_mode(struct net_device *); 92static void set_rx_mode(struct net_device *);
93static struct net_device_stats *au1000_get_stats(struct net_device *);
94static int au1000_ioctl(struct net_device *, struct ifreq *, int); 93static int au1000_ioctl(struct net_device *, struct ifreq *, int);
95static int mdio_read(struct net_device *, int, int); 94static int mdio_read(struct net_device *, int, int);
96static void mdio_write(struct net_device *, int, int, u16); 95static void mdio_write(struct net_device *, int, int, u16);
@@ -772,7 +771,6 @@ static struct net_device * au1000_probe(int port_num)
772 dev->open = au1000_open; 771 dev->open = au1000_open;
773 dev->hard_start_xmit = au1000_tx; 772 dev->hard_start_xmit = au1000_tx;
774 dev->stop = au1000_close; 773 dev->stop = au1000_close;
775 dev->get_stats = au1000_get_stats;
776 dev->set_multicast_list = &set_rx_mode; 774 dev->set_multicast_list = &set_rx_mode;
777 dev->do_ioctl = &au1000_ioctl; 775 dev->do_ioctl = &au1000_ioctl;
778 SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops); 776 SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
@@ -1038,7 +1036,7 @@ static void __exit au1000_cleanup_module(void)
1038static void update_tx_stats(struct net_device *dev, u32 status) 1036static void update_tx_stats(struct net_device *dev, u32 status)
1039{ 1037{
1040 struct au1000_private *aup = (struct au1000_private *) dev->priv; 1038 struct au1000_private *aup = (struct au1000_private *) dev->priv;
1041 struct net_device_stats *ps = &aup->stats; 1039 struct net_device_stats *ps = &dev->stats;
1042 1040
1043 if (status & TX_FRAME_ABORTED) { 1041 if (status & TX_FRAME_ABORTED) {
1044 if (!aup->phy_dev || (DUPLEX_FULL == aup->phy_dev->duplex)) { 1042 if (!aup->phy_dev || (DUPLEX_FULL == aup->phy_dev->duplex)) {
@@ -1094,7 +1092,7 @@ static void au1000_tx_ack(struct net_device *dev)
1094static int au1000_tx(struct sk_buff *skb, struct net_device *dev) 1092static int au1000_tx(struct sk_buff *skb, struct net_device *dev)
1095{ 1093{
1096 struct au1000_private *aup = (struct au1000_private *) dev->priv; 1094 struct au1000_private *aup = (struct au1000_private *) dev->priv;
1097 struct net_device_stats *ps = &aup->stats; 1095 struct net_device_stats *ps = &dev->stats;
1098 volatile tx_dma_t *ptxd; 1096 volatile tx_dma_t *ptxd;
1099 u32 buff_stat; 1097 u32 buff_stat;
1100 db_dest_t *pDB; 1098 db_dest_t *pDB;
@@ -1148,7 +1146,7 @@ static int au1000_tx(struct sk_buff *skb, struct net_device *dev)
1148static inline void update_rx_stats(struct net_device *dev, u32 status) 1146static inline void update_rx_stats(struct net_device *dev, u32 status)
1149{ 1147{
1150 struct au1000_private *aup = (struct au1000_private *) dev->priv; 1148 struct au1000_private *aup = (struct au1000_private *) dev->priv;
1151 struct net_device_stats *ps = &aup->stats; 1149 struct net_device_stats *ps = &dev->stats;
1152 1150
1153 ps->rx_packets++; 1151 ps->rx_packets++;
1154 if (status & RX_MCAST_FRAME) 1152 if (status & RX_MCAST_FRAME)
@@ -1201,7 +1199,7 @@ static int au1000_rx(struct net_device *dev)
1201 printk(KERN_ERR 1199 printk(KERN_ERR
1202 "%s: Memory squeeze, dropping packet.\n", 1200 "%s: Memory squeeze, dropping packet.\n",
1203 dev->name); 1201 dev->name);
1204 aup->stats.rx_dropped++; 1202 dev->stats.rx_dropped++;
1205 continue; 1203 continue;
1206 } 1204 }
1207 skb_reserve(skb, 2); /* 16 byte IP header align */ 1205 skb_reserve(skb, 2); /* 16 byte IP header align */
@@ -1324,18 +1322,5 @@ static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1324 return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd); 1322 return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd);
1325} 1323}
1326 1324
1327static struct net_device_stats *au1000_get_stats(struct net_device *dev)
1328{
1329 struct au1000_private *aup = (struct au1000_private *) dev->priv;
1330
1331 if (au1000_debug > 4)
1332 printk("%s: au1000_get_stats: dev=%p\n", dev->name, dev);
1333
1334 if (netif_device_present(dev)) {
1335 return &aup->stats;
1336 }
1337 return 0;
1338}
1339
1340module_init(au1000_init_module); 1325module_init(au1000_init_module);
1341module_exit(au1000_cleanup_module); 1326module_exit(au1000_cleanup_module);