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/ibmveth.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/ibmveth.c')
-rw-r--r-- | drivers/net/ibmveth.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index db908c40dbe1..bdbf3dead4e2 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -87,7 +87,6 @@ static int ibmveth_close(struct net_device *dev); | |||
87 | static int ibmveth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); | 87 | static int ibmveth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); |
88 | static int ibmveth_poll(struct napi_struct *napi, int budget); | 88 | static int ibmveth_poll(struct napi_struct *napi, int budget); |
89 | static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *dev); | 89 | static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *dev); |
90 | static struct net_device_stats *ibmveth_get_stats(struct net_device *dev); | ||
91 | static void ibmveth_set_multicast_list(struct net_device *dev); | 90 | static void ibmveth_set_multicast_list(struct net_device *dev); |
92 | static int ibmveth_change_mtu(struct net_device *dev, int new_mtu); | 91 | static int ibmveth_change_mtu(struct net_device *dev, int new_mtu); |
93 | static void ibmveth_proc_register_driver(void); | 92 | static void ibmveth_proc_register_driver(void); |
@@ -909,9 +908,9 @@ static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
909 | skb->len, DMA_TO_DEVICE); | 908 | skb->len, DMA_TO_DEVICE); |
910 | 909 | ||
911 | out: spin_lock_irqsave(&adapter->stats_lock, flags); | 910 | out: spin_lock_irqsave(&adapter->stats_lock, flags); |
912 | adapter->stats.tx_dropped += tx_dropped; | 911 | netdev->stats.tx_dropped += tx_dropped; |
913 | adapter->stats.tx_bytes += tx_bytes; | 912 | netdev->stats.tx_bytes += tx_bytes; |
914 | adapter->stats.tx_packets += tx_packets; | 913 | netdev->stats.tx_packets += tx_packets; |
915 | adapter->tx_send_failed += tx_send_failed; | 914 | adapter->tx_send_failed += tx_send_failed; |
916 | adapter->tx_map_failed += tx_map_failed; | 915 | adapter->tx_map_failed += tx_map_failed; |
917 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | 916 | spin_unlock_irqrestore(&adapter->stats_lock, flags); |
@@ -957,8 +956,8 @@ static int ibmveth_poll(struct napi_struct *napi, int budget) | |||
957 | 956 | ||
958 | netif_receive_skb(skb); /* send it up */ | 957 | netif_receive_skb(skb); /* send it up */ |
959 | 958 | ||
960 | adapter->stats.rx_packets++; | 959 | netdev->stats.rx_packets++; |
961 | adapter->stats.rx_bytes += length; | 960 | netdev->stats.rx_bytes += length; |
962 | frames_processed++; | 961 | frames_processed++; |
963 | netdev->last_rx = jiffies; | 962 | netdev->last_rx = jiffies; |
964 | } | 963 | } |
@@ -1003,12 +1002,6 @@ static irqreturn_t ibmveth_interrupt(int irq, void *dev_instance) | |||
1003 | return IRQ_HANDLED; | 1002 | return IRQ_HANDLED; |
1004 | } | 1003 | } |
1005 | 1004 | ||
1006 | static struct net_device_stats *ibmveth_get_stats(struct net_device *dev) | ||
1007 | { | ||
1008 | struct ibmveth_adapter *adapter = dev->priv; | ||
1009 | return &adapter->stats; | ||
1010 | } | ||
1011 | |||
1012 | static void ibmveth_set_multicast_list(struct net_device *netdev) | 1005 | static void ibmveth_set_multicast_list(struct net_device *netdev) |
1013 | { | 1006 | { |
1014 | struct ibmveth_adapter *adapter = netdev->priv; | 1007 | struct ibmveth_adapter *adapter = netdev->priv; |
@@ -1170,7 +1163,6 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_ | |||
1170 | netdev->open = ibmveth_open; | 1163 | netdev->open = ibmveth_open; |
1171 | netdev->stop = ibmveth_close; | 1164 | netdev->stop = ibmveth_close; |
1172 | netdev->hard_start_xmit = ibmveth_start_xmit; | 1165 | netdev->hard_start_xmit = ibmveth_start_xmit; |
1173 | netdev->get_stats = ibmveth_get_stats; | ||
1174 | netdev->set_multicast_list = ibmveth_set_multicast_list; | 1166 | netdev->set_multicast_list = ibmveth_set_multicast_list; |
1175 | netdev->do_ioctl = ibmveth_ioctl; | 1167 | netdev->do_ioctl = ibmveth_ioctl; |
1176 | netdev->ethtool_ops = &netdev_ethtool_ops; | 1168 | netdev->ethtool_ops = &netdev_ethtool_ops; |