diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2010-08-18 18:10:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-19 20:19:04 -0400 |
commit | 5dbfbc4027f819c3da92844f34f241524f99c9eb (patch) | |
tree | 5db91705b1c2b4e5d536afb1355c4159ee79351d /drivers/net/arm/ep93xx_eth.c | |
parent | b9959c2e4460b1df1d113d829180398588bb04b4 (diff) |
ep93xx_eth: Use net_device_stats from struct net_device
struct net_device has its own struct net_device_stats member, so use
this one instead of a private copy in the ep93xx_priv struct. As the new
ndo_get_stats function would just return dev->stats we can omit it.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/arm/ep93xx_eth.c')
-rw-r--r-- | drivers/net/arm/ep93xx_eth.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c index 4a5ec9470aa1..5a77001b6d10 100644 --- a/drivers/net/arm/ep93xx_eth.c +++ b/drivers/net/arm/ep93xx_eth.c | |||
@@ -175,8 +175,6 @@ struct ep93xx_priv | |||
175 | struct net_device *dev; | 175 | struct net_device *dev; |
176 | struct napi_struct napi; | 176 | struct napi_struct napi; |
177 | 177 | ||
178 | struct net_device_stats stats; | ||
179 | |||
180 | struct mii_if_info mii; | 178 | struct mii_if_info mii; |
181 | u8 mdc_divisor; | 179 | u8 mdc_divisor; |
182 | }; | 180 | }; |
@@ -230,12 +228,6 @@ static void ep93xx_mdio_write(struct net_device *dev, int phy_id, int reg, int d | |||
230 | pr_info("mdio write timed out\n"); | 228 | pr_info("mdio write timed out\n"); |
231 | } | 229 | } |
232 | 230 | ||
233 | static struct net_device_stats *ep93xx_get_stats(struct net_device *dev) | ||
234 | { | ||
235 | struct ep93xx_priv *ep = netdev_priv(dev); | ||
236 | return &(ep->stats); | ||
237 | } | ||
238 | |||
239 | static int ep93xx_rx(struct net_device *dev, int processed, int budget) | 231 | static int ep93xx_rx(struct net_device *dev, int processed, int budget) |
240 | { | 232 | { |
241 | struct ep93xx_priv *ep = netdev_priv(dev); | 233 | struct ep93xx_priv *ep = netdev_priv(dev); |
@@ -267,15 +259,15 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget) | |||
267 | pr_crit("entry mismatch %.8x %.8x\n", rstat0, rstat1); | 259 | pr_crit("entry mismatch %.8x %.8x\n", rstat0, rstat1); |
268 | 260 | ||
269 | if (!(rstat0 & RSTAT0_RWE)) { | 261 | if (!(rstat0 & RSTAT0_RWE)) { |
270 | ep->stats.rx_errors++; | 262 | dev->stats.rx_errors++; |
271 | if (rstat0 & RSTAT0_OE) | 263 | if (rstat0 & RSTAT0_OE) |
272 | ep->stats.rx_fifo_errors++; | 264 | dev->stats.rx_fifo_errors++; |
273 | if (rstat0 & RSTAT0_FE) | 265 | if (rstat0 & RSTAT0_FE) |
274 | ep->stats.rx_frame_errors++; | 266 | dev->stats.rx_frame_errors++; |
275 | if (rstat0 & (RSTAT0_RUNT | RSTAT0_EDATA)) | 267 | if (rstat0 & (RSTAT0_RUNT | RSTAT0_EDATA)) |
276 | ep->stats.rx_length_errors++; | 268 | dev->stats.rx_length_errors++; |
277 | if (rstat0 & RSTAT0_CRCE) | 269 | if (rstat0 & RSTAT0_CRCE) |
278 | ep->stats.rx_crc_errors++; | 270 | dev->stats.rx_crc_errors++; |
279 | goto err; | 271 | goto err; |
280 | } | 272 | } |
281 | 273 | ||
@@ -300,10 +292,10 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget) | |||
300 | 292 | ||
301 | netif_receive_skb(skb); | 293 | netif_receive_skb(skb); |
302 | 294 | ||
303 | ep->stats.rx_packets++; | 295 | dev->stats.rx_packets++; |
304 | ep->stats.rx_bytes += length; | 296 | dev->stats.rx_bytes += length; |
305 | } else { | 297 | } else { |
306 | ep->stats.rx_dropped++; | 298 | dev->stats.rx_dropped++; |
307 | } | 299 | } |
308 | 300 | ||
309 | err: | 301 | err: |
@@ -359,7 +351,7 @@ static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev) | |||
359 | int entry; | 351 | int entry; |
360 | 352 | ||
361 | if (unlikely(skb->len > MAX_PKT_SIZE)) { | 353 | if (unlikely(skb->len > MAX_PKT_SIZE)) { |
362 | ep->stats.tx_dropped++; | 354 | dev->stats.tx_dropped++; |
363 | dev_kfree_skb(skb); | 355 | dev_kfree_skb(skb); |
364 | return NETDEV_TX_OK; | 356 | return NETDEV_TX_OK; |
365 | } | 357 | } |
@@ -415,17 +407,17 @@ static void ep93xx_tx_complete(struct net_device *dev) | |||
415 | if (tstat0 & TSTAT0_TXWE) { | 407 | if (tstat0 & TSTAT0_TXWE) { |
416 | int length = ep->descs->tdesc[entry].tdesc1 & 0xfff; | 408 | int length = ep->descs->tdesc[entry].tdesc1 & 0xfff; |
417 | 409 | ||
418 | ep->stats.tx_packets++; | 410 | dev->stats.tx_packets++; |
419 | ep->stats.tx_bytes += length; | 411 | dev->stats.tx_bytes += length; |
420 | } else { | 412 | } else { |
421 | ep->stats.tx_errors++; | 413 | dev->stats.tx_errors++; |
422 | } | 414 | } |
423 | 415 | ||
424 | if (tstat0 & TSTAT0_OW) | 416 | if (tstat0 & TSTAT0_OW) |
425 | ep->stats.tx_window_errors++; | 417 | dev->stats.tx_window_errors++; |
426 | if (tstat0 & TSTAT0_TXU) | 418 | if (tstat0 & TSTAT0_TXU) |
427 | ep->stats.tx_fifo_errors++; | 419 | dev->stats.tx_fifo_errors++; |
428 | ep->stats.collisions += (tstat0 >> 16) & 0x1f; | 420 | dev->stats.collisions += (tstat0 >> 16) & 0x1f; |
429 | 421 | ||
430 | ep->tx_clean_pointer = (entry + 1) & (TX_QUEUE_ENTRIES - 1); | 422 | ep->tx_clean_pointer = (entry + 1) & (TX_QUEUE_ENTRIES - 1); |
431 | if (ep->tx_pending == TX_QUEUE_ENTRIES) | 423 | if (ep->tx_pending == TX_QUEUE_ENTRIES) |
@@ -758,7 +750,6 @@ static const struct net_device_ops ep93xx_netdev_ops = { | |||
758 | .ndo_open = ep93xx_open, | 750 | .ndo_open = ep93xx_open, |
759 | .ndo_stop = ep93xx_close, | 751 | .ndo_stop = ep93xx_close, |
760 | .ndo_start_xmit = ep93xx_xmit, | 752 | .ndo_start_xmit = ep93xx_xmit, |
761 | .ndo_get_stats = ep93xx_get_stats, | ||
762 | .ndo_do_ioctl = ep93xx_ioctl, | 753 | .ndo_do_ioctl = ep93xx_ioctl, |
763 | .ndo_validate_addr = eth_validate_addr, | 754 | .ndo_validate_addr = eth_validate_addr, |
764 | .ndo_change_mtu = eth_change_mtu, | 755 | .ndo_change_mtu = eth_change_mtu, |