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/e100.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/e100.c')
-rw-r--r-- | drivers/net/e100.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index f9aa13e04ada..99126564f1a0 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -558,7 +558,6 @@ struct nic { | |||
558 | enum mac mac; | 558 | enum mac mac; |
559 | enum phy phy; | 559 | enum phy phy; |
560 | struct params params; | 560 | struct params params; |
561 | struct net_device_stats net_stats; | ||
562 | struct timer_list watchdog; | 561 | struct timer_list watchdog; |
563 | struct timer_list blink_timer; | 562 | struct timer_list blink_timer; |
564 | struct mii_if_info mii; | 563 | struct mii_if_info mii; |
@@ -1483,7 +1482,8 @@ static void e100_set_multicast_list(struct net_device *netdev) | |||
1483 | 1482 | ||
1484 | static void e100_update_stats(struct nic *nic) | 1483 | static void e100_update_stats(struct nic *nic) |
1485 | { | 1484 | { |
1486 | struct net_device_stats *ns = &nic->net_stats; | 1485 | struct net_device *dev = nic->netdev; |
1486 | struct net_device_stats *ns = &dev->stats; | ||
1487 | struct stats *s = &nic->mem->stats; | 1487 | struct stats *s = &nic->mem->stats; |
1488 | u32 *complete = (nic->mac < mac_82558_D101_A4) ? &s->fc_xmt_pause : | 1488 | u32 *complete = (nic->mac < mac_82558_D101_A4) ? &s->fc_xmt_pause : |
1489 | (nic->mac < mac_82559_D101M) ? (u32 *)&s->xmt_tco_frames : | 1489 | (nic->mac < mac_82559_D101M) ? (u32 *)&s->xmt_tco_frames : |
@@ -1661,6 +1661,7 @@ static int e100_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1661 | 1661 | ||
1662 | static int e100_tx_clean(struct nic *nic) | 1662 | static int e100_tx_clean(struct nic *nic) |
1663 | { | 1663 | { |
1664 | struct net_device *dev = nic->netdev; | ||
1664 | struct cb *cb; | 1665 | struct cb *cb; |
1665 | int tx_cleaned = 0; | 1666 | int tx_cleaned = 0; |
1666 | 1667 | ||
@@ -1675,8 +1676,8 @@ static int e100_tx_clean(struct nic *nic) | |||
1675 | cb->status); | 1676 | cb->status); |
1676 | 1677 | ||
1677 | if(likely(cb->skb != NULL)) { | 1678 | if(likely(cb->skb != NULL)) { |
1678 | nic->net_stats.tx_packets++; | 1679 | dev->stats.tx_packets++; |
1679 | nic->net_stats.tx_bytes += cb->skb->len; | 1680 | dev->stats.tx_bytes += cb->skb->len; |
1680 | 1681 | ||
1681 | pci_unmap_single(nic->pdev, | 1682 | pci_unmap_single(nic->pdev, |
1682 | le32_to_cpu(cb->u.tcb.tbd.buf_addr), | 1683 | le32_to_cpu(cb->u.tcb.tbd.buf_addr), |
@@ -1807,6 +1808,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) | |||
1807 | static int e100_rx_indicate(struct nic *nic, struct rx *rx, | 1808 | static int e100_rx_indicate(struct nic *nic, struct rx *rx, |
1808 | unsigned int *work_done, unsigned int work_to_do) | 1809 | unsigned int *work_done, unsigned int work_to_do) |
1809 | { | 1810 | { |
1811 | struct net_device *dev = nic->netdev; | ||
1810 | struct sk_buff *skb = rx->skb; | 1812 | struct sk_buff *skb = rx->skb; |
1811 | struct rfd *rfd = (struct rfd *)skb->data; | 1813 | struct rfd *rfd = (struct rfd *)skb->data; |
1812 | u16 rfd_status, actual_size; | 1814 | u16 rfd_status, actual_size; |
@@ -1851,8 +1853,8 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, | |||
1851 | nic->rx_over_length_errors++; | 1853 | nic->rx_over_length_errors++; |
1852 | dev_kfree_skb_any(skb); | 1854 | dev_kfree_skb_any(skb); |
1853 | } else { | 1855 | } else { |
1854 | nic->net_stats.rx_packets++; | 1856 | dev->stats.rx_packets++; |
1855 | nic->net_stats.rx_bytes += actual_size; | 1857 | dev->stats.rx_bytes += actual_size; |
1856 | nic->netdev->last_rx = jiffies; | 1858 | nic->netdev->last_rx = jiffies; |
1857 | netif_receive_skb(skb); | 1859 | netif_receive_skb(skb); |
1858 | if(work_done) | 1860 | if(work_done) |
@@ -2015,12 +2017,6 @@ static void e100_netpoll(struct net_device *netdev) | |||
2015 | } | 2017 | } |
2016 | #endif | 2018 | #endif |
2017 | 2019 | ||
2018 | static struct net_device_stats *e100_get_stats(struct net_device *netdev) | ||
2019 | { | ||
2020 | struct nic *nic = netdev_priv(netdev); | ||
2021 | return &nic->net_stats; | ||
2022 | } | ||
2023 | |||
2024 | static int e100_set_mac_address(struct net_device *netdev, void *p) | 2020 | static int e100_set_mac_address(struct net_device *netdev, void *p) |
2025 | { | 2021 | { |
2026 | struct nic *nic = netdev_priv(netdev); | 2022 | struct nic *nic = netdev_priv(netdev); |
@@ -2457,7 +2453,7 @@ static void e100_get_ethtool_stats(struct net_device *netdev, | |||
2457 | int i; | 2453 | int i; |
2458 | 2454 | ||
2459 | for(i = 0; i < E100_NET_STATS_LEN; i++) | 2455 | for(i = 0; i < E100_NET_STATS_LEN; i++) |
2460 | data[i] = ((unsigned long *)&nic->net_stats)[i]; | 2456 | data[i] = ((unsigned long *)&netdev->stats)[i]; |
2461 | 2457 | ||
2462 | data[i++] = nic->tx_deferred; | 2458 | data[i++] = nic->tx_deferred; |
2463 | data[i++] = nic->tx_single_collisions; | 2459 | data[i++] = nic->tx_single_collisions; |
@@ -2562,7 +2558,6 @@ static int __devinit e100_probe(struct pci_dev *pdev, | |||
2562 | netdev->open = e100_open; | 2558 | netdev->open = e100_open; |
2563 | netdev->stop = e100_close; | 2559 | netdev->stop = e100_close; |
2564 | netdev->hard_start_xmit = e100_xmit_frame; | 2560 | netdev->hard_start_xmit = e100_xmit_frame; |
2565 | netdev->get_stats = e100_get_stats; | ||
2566 | netdev->set_multicast_list = e100_set_multicast_list; | 2561 | netdev->set_multicast_list = e100_set_multicast_list; |
2567 | netdev->set_mac_address = e100_set_mac_address; | 2562 | netdev->set_mac_address = e100_set_mac_address; |
2568 | netdev->change_mtu = e100_change_mtu; | 2563 | netdev->change_mtu = e100_change_mtu; |