[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
@@ -530,8 +530,8 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit)
|
||||
} else
|
||||
skb->ip_summed = CHECKSUM_NONE;
|
||||
|
||||
mac->stats.rx_bytes += len;
|
||||
mac->stats.rx_packets++;
|
||||
mac->netdev->stats.rx_bytes += len;
|
||||
mac->netdev->stats.rx_packets++;
|
||||
|
||||
skb->protocol = eth_type_trans(skb, mac->netdev);
|
||||
netif_receive_skb(skb);
|
||||
@@ -1032,8 +1032,8 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
|
||||
info->skb = skb;
|
||||
|
||||
txring->next_to_fill++;
|
||||
mac->stats.tx_packets++;
|
||||
mac->stats.tx_bytes += skb->len;
|
||||
dev->stats.tx_packets++;
|
||||
dev->stats.tx_bytes += skb->len;
|
||||
|
||||
spin_unlock_irqrestore(&txring->lock, flags);
|
||||
|
||||
@@ -1047,14 +1047,6 @@ out_err:
|
||||
return NETDEV_TX_BUSY;
|
||||
}
|
||||
|
||||
static struct net_device_stats *pasemi_mac_get_stats(struct net_device *dev)
|
||||
{
|
||||
struct pasemi_mac *mac = netdev_priv(dev);
|
||||
|
||||
return &mac->stats;
|
||||
}
|
||||
|
||||
|
||||
static void pasemi_mac_set_rx_mode(struct net_device *dev)
|
||||
{
|
||||
struct pasemi_mac *mac = netdev_priv(dev);
|
||||
@@ -1223,7 +1215,6 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
dev->open = pasemi_mac_open;
|
||||
dev->stop = pasemi_mac_close;
|
||||
dev->hard_start_xmit = pasemi_mac_start_tx;
|
||||
dev->get_stats = pasemi_mac_get_stats;
|
||||
dev->set_multicast_list = pasemi_mac_set_rx_mode;
|
||||
|
||||
err = pasemi_mac_map_regs(mac);
|
||||
|
Reference in New Issue
Block a user