aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netx-eth.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-03 20:41:50 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:16 -0400
commit09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (patch)
tree4c85b0b395abe7f88c87162fc22570e5de255cb1 /drivers/net/netx-eth.c
parentff8ac60948ba819b89e9c87083e8050fc2f89999 (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/netx-eth.c')
-rw-r--r--drivers/net/netx-eth.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/net/netx-eth.c b/drivers/net/netx-eth.c
index 6fee405d8403..eb0aff787dfd 100644
--- a/drivers/net/netx-eth.c
+++ b/drivers/net/netx-eth.c
@@ -97,7 +97,6 @@
97struct netx_eth_priv { 97struct netx_eth_priv {
98 void __iomem *sram_base, *xpec_base, *xmac_base; 98 void __iomem *sram_base, *xpec_base, *xmac_base;
99 int id; 99 int id;
100 struct net_device_stats stats;
101 struct mii_if_info mii; 100 struct mii_if_info mii;
102 u32 msg_enable; 101 u32 msg_enable;
103 struct xc *xc; 102 struct xc *xc;
@@ -129,8 +128,8 @@ netx_eth_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
129 FIFO_PTR_FRAMELEN(len)); 128 FIFO_PTR_FRAMELEN(len));
130 129
131 ndev->trans_start = jiffies; 130 ndev->trans_start = jiffies;
132 priv->stats.tx_packets++; 131 dev->stats.tx_packets++;
133 priv->stats.tx_bytes += skb->len; 132 dev->stats.tx_bytes += skb->len;
134 133
135 netif_stop_queue(ndev); 134 netif_stop_queue(ndev);
136 spin_unlock_irq(&priv->lock); 135 spin_unlock_irq(&priv->lock);
@@ -156,7 +155,7 @@ static void netx_eth_receive(struct net_device *ndev)
156 if (unlikely(skb == NULL)) { 155 if (unlikely(skb == NULL)) {
157 printk(KERN_NOTICE "%s: Low memory, packet dropped.\n", 156 printk(KERN_NOTICE "%s: Low memory, packet dropped.\n",
158 ndev->name); 157 ndev->name);
159 priv->stats.rx_dropped++; 158 dev->stats.rx_dropped++;
160 return; 159 return;
161 } 160 }
162 161
@@ -170,8 +169,8 @@ static void netx_eth_receive(struct net_device *ndev)
170 ndev->last_rx = jiffies; 169 ndev->last_rx = jiffies;
171 skb->protocol = eth_type_trans(skb, ndev); 170 skb->protocol = eth_type_trans(skb, ndev);
172 netif_rx(skb); 171 netif_rx(skb);
173 priv->stats.rx_packets++; 172 dev->stats.rx_packets++;
174 priv->stats.rx_bytes += len; 173 dev->stats.rx_bytes += len;
175} 174}
176 175
177static irqreturn_t 176static irqreturn_t
@@ -210,12 +209,6 @@ netx_eth_interrupt(int irq, void *dev_id)
210 return IRQ_HANDLED; 209 return IRQ_HANDLED;
211} 210}
212 211
213static struct net_device_stats *netx_eth_query_statistics(struct net_device *ndev)
214{
215 struct netx_eth_priv *priv = netdev_priv(ndev);
216 return &priv->stats;
217}
218
219static int netx_eth_open(struct net_device *ndev) 212static int netx_eth_open(struct net_device *ndev)
220{ 213{
221 struct netx_eth_priv *priv = netdev_priv(ndev); 214 struct netx_eth_priv *priv = netdev_priv(ndev);
@@ -323,7 +316,6 @@ static int netx_eth_enable(struct net_device *ndev)
323 ndev->hard_start_xmit = netx_eth_hard_start_xmit; 316 ndev->hard_start_xmit = netx_eth_hard_start_xmit;
324 ndev->tx_timeout = netx_eth_timeout; 317 ndev->tx_timeout = netx_eth_timeout;
325 ndev->watchdog_timeo = msecs_to_jiffies(5000); 318 ndev->watchdog_timeo = msecs_to_jiffies(5000);
326 ndev->get_stats = netx_eth_query_statistics;
327 ndev->set_multicast_list = netx_eth_set_multicast_list; 319 ndev->set_multicast_list = netx_eth_set_multicast_list;
328 320
329 priv->msg_enable = NETIF_MSG_LINK; 321 priv->msg_enable = NETIF_MSG_LINK;