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/mv643xx_eth.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/mv643xx_eth.c')
-rw-r--r-- | drivers/net/mv643xx_eth.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 2a808e265a3e..35781616eb23 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -63,7 +63,6 @@ static unsigned int mv643xx_eth_port_disable_rx(unsigned int port_num); | |||
63 | static int mv643xx_eth_open(struct net_device *); | 63 | static int mv643xx_eth_open(struct net_device *); |
64 | static int mv643xx_eth_stop(struct net_device *); | 64 | static int mv643xx_eth_stop(struct net_device *); |
65 | static int mv643xx_eth_change_mtu(struct net_device *, int); | 65 | static int mv643xx_eth_change_mtu(struct net_device *, int); |
66 | static struct net_device_stats *mv643xx_eth_get_stats(struct net_device *); | ||
67 | static void eth_port_init_mac_tables(unsigned int eth_port_num); | 66 | static void eth_port_init_mac_tables(unsigned int eth_port_num); |
68 | #ifdef MV643XX_NAPI | 67 | #ifdef MV643XX_NAPI |
69 | static int mv643xx_poll(struct napi_struct *napi, int budget); | 68 | static int mv643xx_poll(struct napi_struct *napi, int budget); |
@@ -341,7 +340,7 @@ int mv643xx_eth_free_tx_descs(struct net_device *dev, int force) | |||
341 | 340 | ||
342 | if (cmd_sts & ETH_ERROR_SUMMARY) { | 341 | if (cmd_sts & ETH_ERROR_SUMMARY) { |
343 | printk("%s: Error in TX\n", dev->name); | 342 | printk("%s: Error in TX\n", dev->name); |
344 | mp->stats.tx_errors++; | 343 | dev->stats.tx_errors++; |
345 | } | 344 | } |
346 | 345 | ||
347 | spin_unlock_irqrestore(&mp->lock, flags); | 346 | spin_unlock_irqrestore(&mp->lock, flags); |
@@ -388,7 +387,7 @@ static void mv643xx_eth_free_all_tx_descs(struct net_device *dev) | |||
388 | static int mv643xx_eth_receive_queue(struct net_device *dev, int budget) | 387 | static int mv643xx_eth_receive_queue(struct net_device *dev, int budget) |
389 | { | 388 | { |
390 | struct mv643xx_private *mp = netdev_priv(dev); | 389 | struct mv643xx_private *mp = netdev_priv(dev); |
391 | struct net_device_stats *stats = &mp->stats; | 390 | struct net_device_stats *stats = &dev->stats; |
392 | unsigned int received_packets = 0; | 391 | unsigned int received_packets = 0; |
393 | struct sk_buff *skb; | 392 | struct sk_buff *skb; |
394 | struct pkt_info pkt_info; | 393 | struct pkt_info pkt_info; |
@@ -1192,7 +1191,7 @@ static void eth_tx_submit_descs_for_skb(struct mv643xx_private *mp, | |||
1192 | static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) | 1191 | static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1193 | { | 1192 | { |
1194 | struct mv643xx_private *mp = netdev_priv(dev); | 1193 | struct mv643xx_private *mp = netdev_priv(dev); |
1195 | struct net_device_stats *stats = &mp->stats; | 1194 | struct net_device_stats *stats = &dev->stats; |
1196 | unsigned long flags; | 1195 | unsigned long flags; |
1197 | 1196 | ||
1198 | BUG_ON(netif_queue_stopped(dev)); | 1197 | BUG_ON(netif_queue_stopped(dev)); |
@@ -1228,23 +1227,6 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1228 | return 0; /* success */ | 1227 | return 0; /* success */ |
1229 | } | 1228 | } |
1230 | 1229 | ||
1231 | /* | ||
1232 | * mv643xx_eth_get_stats | ||
1233 | * | ||
1234 | * Returns a pointer to the interface statistics. | ||
1235 | * | ||
1236 | * Input : dev - a pointer to the required interface | ||
1237 | * | ||
1238 | * Output : a pointer to the interface's statistics | ||
1239 | */ | ||
1240 | |||
1241 | static struct net_device_stats *mv643xx_eth_get_stats(struct net_device *dev) | ||
1242 | { | ||
1243 | struct mv643xx_private *mp = netdev_priv(dev); | ||
1244 | |||
1245 | return &mp->stats; | ||
1246 | } | ||
1247 | |||
1248 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1230 | #ifdef CONFIG_NET_POLL_CONTROLLER |
1249 | static void mv643xx_netpoll(struct net_device *netdev) | 1231 | static void mv643xx_netpoll(struct net_device *netdev) |
1250 | { | 1232 | { |
@@ -1339,7 +1321,6 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1339 | dev->open = mv643xx_eth_open; | 1321 | dev->open = mv643xx_eth_open; |
1340 | dev->stop = mv643xx_eth_stop; | 1322 | dev->stop = mv643xx_eth_stop; |
1341 | dev->hard_start_xmit = mv643xx_eth_start_xmit; | 1323 | dev->hard_start_xmit = mv643xx_eth_start_xmit; |
1342 | dev->get_stats = mv643xx_eth_get_stats; | ||
1343 | dev->set_mac_address = mv643xx_eth_set_mac_address; | 1324 | dev->set_mac_address = mv643xx_eth_set_mac_address; |
1344 | dev->set_multicast_list = mv643xx_eth_set_rx_mode; | 1325 | dev->set_multicast_list = mv643xx_eth_set_rx_mode; |
1345 | 1326 | ||