diff options
-rw-r--r-- | drivers/net/r6040.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c index 2334f4ebf907..325a8e433bd4 100644 --- a/drivers/net/r6040.c +++ b/drivers/net/r6040.c | |||
@@ -174,7 +174,6 @@ struct r6040_private { | |||
174 | struct net_device *dev; | 174 | struct net_device *dev; |
175 | struct mii_if_info mii_if; | 175 | struct mii_if_info mii_if; |
176 | struct napi_struct napi; | 176 | struct napi_struct napi; |
177 | struct net_device_stats stats; | ||
178 | u16 napi_rx_running; | 177 | u16 napi_rx_running; |
179 | void __iomem *base; | 178 | void __iomem *base; |
180 | }; | 179 | }; |
@@ -280,11 +279,11 @@ static struct net_device_stats *r6040_get_stats(struct net_device *dev) | |||
280 | unsigned long flags; | 279 | unsigned long flags; |
281 | 280 | ||
282 | spin_lock_irqsave(&priv->lock, flags); | 281 | spin_lock_irqsave(&priv->lock, flags); |
283 | priv->stats.rx_crc_errors += ioread8(ioaddr + ME_CNT1); | 282 | dev->stats.rx_crc_errors += ioread8(ioaddr + ME_CNT1); |
284 | priv->stats.multicast += ioread8(ioaddr + ME_CNT0); | 283 | dev->stats.multicast += ioread8(ioaddr + ME_CNT0); |
285 | spin_unlock_irqrestore(&priv->lock, flags); | 284 | spin_unlock_irqrestore(&priv->lock, flags); |
286 | 285 | ||
287 | return &priv->stats; | 286 | return &dev->stats; |
288 | } | 287 | } |
289 | 288 | ||
290 | /* Stop RDC MAC and Free the allocated resource */ | 289 | /* Stop RDC MAC and Free the allocated resource */ |
@@ -432,19 +431,24 @@ static int r6040_rx(struct net_device *dev, int limit) | |||
432 | 431 | ||
433 | /* Check for errors */ | 432 | /* Check for errors */ |
434 | err = ioread16(ioaddr + MLSR); | 433 | err = ioread16(ioaddr + MLSR); |
435 | if (err & 0x0400) priv->stats.rx_errors++; | 434 | if (err & 0x0400) |
435 | dev->stats.rx_errors++; | ||
436 | /* RX FIFO over-run */ | 436 | /* RX FIFO over-run */ |
437 | if (err & 0x8000) priv->stats.rx_fifo_errors++; | 437 | if (err & 0x8000) |
438 | dev->stats.rx_fifo_errors++; | ||
438 | /* RX descriptor unavailable */ | 439 | /* RX descriptor unavailable */ |
439 | if (err & 0x0080) priv->stats.rx_frame_errors++; | 440 | if (err & 0x0080) |
441 | dev->stats.rx_frame_errors++; | ||
440 | /* Received packet with length over buffer lenght */ | 442 | /* Received packet with length over buffer lenght */ |
441 | if (err & 0x0020) priv->stats.rx_over_errors++; | 443 | if (err & 0x0020) |
444 | dev->stats.rx_over_errors++; | ||
442 | /* Received packet with too long or short */ | 445 | /* Received packet with too long or short */ |
443 | if (err & (0x0010|0x0008)) priv->stats.rx_length_errors++; | 446 | if (err & (0x0010 | 0x0008)) |
447 | dev->stats.rx_length_errors++; | ||
444 | /* Received packet with CRC errors */ | 448 | /* Received packet with CRC errors */ |
445 | if (err & 0x0004) { | 449 | if (err & 0x0004) { |
446 | spin_lock(&priv->lock); | 450 | spin_lock(&priv->lock); |
447 | priv->stats.rx_crc_errors++; | 451 | dev->stats.rx_crc_errors++; |
448 | spin_unlock(&priv->lock); | 452 | spin_unlock(&priv->lock); |
449 | } | 453 | } |
450 | 454 | ||
@@ -469,8 +473,8 @@ static int r6040_rx(struct net_device *dev, int limit) | |||
469 | /* Send to upper layer */ | 473 | /* Send to upper layer */ |
470 | netif_receive_skb(skb_ptr); | 474 | netif_receive_skb(skb_ptr); |
471 | dev->last_rx = jiffies; | 475 | dev->last_rx = jiffies; |
472 | priv->dev->stats.rx_packets++; | 476 | dev->stats.rx_packets++; |
473 | priv->dev->stats.rx_bytes += descptr->len; | 477 | dev->stats.rx_bytes += descptr->len; |
474 | /* To next descriptor */ | 478 | /* To next descriptor */ |
475 | descptr = descptr->vndescp; | 479 | descptr = descptr->vndescp; |
476 | priv->rx_free_desc--; | 480 | priv->rx_free_desc--; |
@@ -498,8 +502,10 @@ static void r6040_tx(struct net_device *dev) | |||
498 | /* Check for errors */ | 502 | /* Check for errors */ |
499 | err = ioread16(ioaddr + MLSR); | 503 | err = ioread16(ioaddr + MLSR); |
500 | 504 | ||
501 | if (err & 0x0200) priv->stats.rx_fifo_errors++; | 505 | if (err & 0x0200) |
502 | if (err & (0x2000 | 0x4000)) priv->stats.tx_carrier_errors++; | 506 | dev->stats.rx_fifo_errors++; |
507 | if (err & (0x2000 | 0x4000)) | ||
508 | dev->stats.tx_carrier_errors++; | ||
503 | 509 | ||
504 | if (descptr->status & 0x8000) | 510 | if (descptr->status & 0x8000) |
505 | break; /* Not complte */ | 511 | break; /* Not complte */ |