[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>
This commit is contained in:
committed by
David S. Miller
parent
ff8ac60948
commit
09f75cd7bf
@ -154,11 +154,6 @@ static int de600_close(struct net_device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct net_device_stats *get_stats(struct net_device *dev)
|
||||
{
|
||||
return (struct net_device_stats *)(dev->priv);
|
||||
}
|
||||
|
||||
static inline void trigger_interrupt(struct net_device *dev)
|
||||
{
|
||||
de600_put_command(FLIP_IRQ);
|
||||
@ -308,7 +303,7 @@ static int de600_tx_intr(struct net_device *dev, int irq_status)
|
||||
if (!(irq_status & TX_FAILED16)) {
|
||||
tx_fifo_out = (tx_fifo_out + 1) % TX_PAGES;
|
||||
++free_tx_pages;
|
||||
((struct net_device_stats *)(dev->priv))->tx_packets++;
|
||||
dev->stats.tx_packets++;
|
||||
netif_wake_queue(dev);
|
||||
}
|
||||
|
||||
@ -375,8 +370,8 @@ static void de600_rx_intr(struct net_device *dev)
|
||||
|
||||
/* update stats */
|
||||
dev->last_rx = jiffies;
|
||||
((struct net_device_stats *)(dev->priv))->rx_packets++; /* count all receives */
|
||||
((struct net_device_stats *)(dev->priv))->rx_bytes += size; /* count all received bytes */
|
||||
dev->stats.rx_packets++; /* count all receives */
|
||||
dev->stats.rx_bytes += size; /* count all received bytes */
|
||||
|
||||
/*
|
||||
* If any worth-while packets have been received, netif_rx()
|
||||
@ -390,7 +385,7 @@ static struct net_device * __init de600_probe(void)
|
||||
struct net_device *dev;
|
||||
int err;
|
||||
|
||||
dev = alloc_etherdev(sizeof(struct net_device_stats));
|
||||
dev = alloc_etherdev(0);
|
||||
if (!dev)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
@ -448,8 +443,6 @@ static struct net_device * __init de600_probe(void)
|
||||
printk(":%02X",dev->dev_addr[i]);
|
||||
printk("\n");
|
||||
|
||||
dev->get_stats = get_stats;
|
||||
|
||||
dev->open = de600_open;
|
||||
dev->stop = de600_close;
|
||||
dev->hard_start_xmit = &de600_start_xmit;
|
||||
|
Reference in New Issue
Block a user