diff options
author | David S. Miller <davem@davemloft.net> | 2009-10-13 15:55:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-13 15:55:20 -0400 |
commit | 421355de876b9f3fcc7e4cb6026e416fb12a5068 (patch) | |
tree | fb814456af86c75e1eb9e330994dda461fc5b4f7 /drivers/net/davinci_emac.c | |
parent | aace495933a981274b6491d71b915165a61defdc (diff) | |
parent | 0fe7463a35aadfaf22d1ca58325ab3851b8d757c (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'drivers/net/davinci_emac.c')
-rw-r--r-- | drivers/net/davinci_emac.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index a421ec046b3c..a876dce13b9e 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -330,6 +330,9 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1"; | |||
330 | #define EMAC_DM646X_MAC_EOI_C0_RXEN (0x01) | 330 | #define EMAC_DM646X_MAC_EOI_C0_RXEN (0x01) |
331 | #define EMAC_DM646X_MAC_EOI_C0_TXEN (0x02) | 331 | #define EMAC_DM646X_MAC_EOI_C0_TXEN (0x02) |
332 | 332 | ||
333 | /* EMAC Stats Clear Mask */ | ||
334 | #define EMAC_STATS_CLR_MASK (0xFFFFFFFF) | ||
335 | |||
333 | /** net_buf_obj: EMAC network bufferdata structure | 336 | /** net_buf_obj: EMAC network bufferdata structure |
334 | * | 337 | * |
335 | * EMAC network buffer data structure | 338 | * EMAC network buffer data structure |
@@ -2544,40 +2547,49 @@ static int emac_dev_stop(struct net_device *ndev) | |||
2544 | static struct net_device_stats *emac_dev_getnetstats(struct net_device *ndev) | 2547 | static struct net_device_stats *emac_dev_getnetstats(struct net_device *ndev) |
2545 | { | 2548 | { |
2546 | struct emac_priv *priv = netdev_priv(ndev); | 2549 | struct emac_priv *priv = netdev_priv(ndev); |
2550 | u32 mac_control; | ||
2551 | u32 stats_clear_mask; | ||
2547 | 2552 | ||
2548 | /* update emac hardware stats and reset the registers*/ | 2553 | /* update emac hardware stats and reset the registers*/ |
2549 | 2554 | ||
2555 | mac_control = emac_read(EMAC_MACCONTROL); | ||
2556 | |||
2557 | if (mac_control & EMAC_MACCONTROL_GMIIEN) | ||
2558 | stats_clear_mask = EMAC_STATS_CLR_MASK; | ||
2559 | else | ||
2560 | stats_clear_mask = 0; | ||
2561 | |||
2550 | priv->net_dev_stats.multicast += emac_read(EMAC_RXMCASTFRAMES); | 2562 | priv->net_dev_stats.multicast += emac_read(EMAC_RXMCASTFRAMES); |
2551 | emac_write(EMAC_RXMCASTFRAMES, EMAC_ALL_MULTI_REG_VALUE); | 2563 | emac_write(EMAC_RXMCASTFRAMES, stats_clear_mask); |
2552 | 2564 | ||
2553 | priv->net_dev_stats.collisions += (emac_read(EMAC_TXCOLLISION) + | 2565 | priv->net_dev_stats.collisions += (emac_read(EMAC_TXCOLLISION) + |
2554 | emac_read(EMAC_TXSINGLECOLL) + | 2566 | emac_read(EMAC_TXSINGLECOLL) + |
2555 | emac_read(EMAC_TXMULTICOLL)); | 2567 | emac_read(EMAC_TXMULTICOLL)); |
2556 | emac_write(EMAC_TXCOLLISION, EMAC_ALL_MULTI_REG_VALUE); | 2568 | emac_write(EMAC_TXCOLLISION, stats_clear_mask); |
2557 | emac_write(EMAC_TXSINGLECOLL, EMAC_ALL_MULTI_REG_VALUE); | 2569 | emac_write(EMAC_TXSINGLECOLL, stats_clear_mask); |
2558 | emac_write(EMAC_TXMULTICOLL, EMAC_ALL_MULTI_REG_VALUE); | 2570 | emac_write(EMAC_TXMULTICOLL, stats_clear_mask); |
2559 | 2571 | ||
2560 | priv->net_dev_stats.rx_length_errors += (emac_read(EMAC_RXOVERSIZED) + | 2572 | priv->net_dev_stats.rx_length_errors += (emac_read(EMAC_RXOVERSIZED) + |
2561 | emac_read(EMAC_RXJABBER) + | 2573 | emac_read(EMAC_RXJABBER) + |
2562 | emac_read(EMAC_RXUNDERSIZED)); | 2574 | emac_read(EMAC_RXUNDERSIZED)); |
2563 | emac_write(EMAC_RXOVERSIZED, EMAC_ALL_MULTI_REG_VALUE); | 2575 | emac_write(EMAC_RXOVERSIZED, stats_clear_mask); |
2564 | emac_write(EMAC_RXJABBER, EMAC_ALL_MULTI_REG_VALUE); | 2576 | emac_write(EMAC_RXJABBER, stats_clear_mask); |
2565 | emac_write(EMAC_RXUNDERSIZED, EMAC_ALL_MULTI_REG_VALUE); | 2577 | emac_write(EMAC_RXUNDERSIZED, stats_clear_mask); |
2566 | 2578 | ||
2567 | priv->net_dev_stats.rx_over_errors += (emac_read(EMAC_RXSOFOVERRUNS) + | 2579 | priv->net_dev_stats.rx_over_errors += (emac_read(EMAC_RXSOFOVERRUNS) + |
2568 | emac_read(EMAC_RXMOFOVERRUNS)); | 2580 | emac_read(EMAC_RXMOFOVERRUNS)); |
2569 | emac_write(EMAC_RXSOFOVERRUNS, EMAC_ALL_MULTI_REG_VALUE); | 2581 | emac_write(EMAC_RXSOFOVERRUNS, stats_clear_mask); |
2570 | emac_write(EMAC_RXMOFOVERRUNS, EMAC_ALL_MULTI_REG_VALUE); | 2582 | emac_write(EMAC_RXMOFOVERRUNS, stats_clear_mask); |
2571 | 2583 | ||
2572 | priv->net_dev_stats.rx_fifo_errors += emac_read(EMAC_RXDMAOVERRUNS); | 2584 | priv->net_dev_stats.rx_fifo_errors += emac_read(EMAC_RXDMAOVERRUNS); |
2573 | emac_write(EMAC_RXDMAOVERRUNS, EMAC_ALL_MULTI_REG_VALUE); | 2585 | emac_write(EMAC_RXDMAOVERRUNS, stats_clear_mask); |
2574 | 2586 | ||
2575 | priv->net_dev_stats.tx_carrier_errors += | 2587 | priv->net_dev_stats.tx_carrier_errors += |
2576 | emac_read(EMAC_TXCARRIERSENSE); | 2588 | emac_read(EMAC_TXCARRIERSENSE); |
2577 | emac_write(EMAC_TXCARRIERSENSE, EMAC_ALL_MULTI_REG_VALUE); | 2589 | emac_write(EMAC_TXCARRIERSENSE, stats_clear_mask); |
2578 | 2590 | ||
2579 | priv->net_dev_stats.tx_fifo_errors = emac_read(EMAC_TXUNDERRUN); | 2591 | priv->net_dev_stats.tx_fifo_errors = emac_read(EMAC_TXUNDERRUN); |
2580 | emac_write(EMAC_TXUNDERRUN, EMAC_ALL_MULTI_REG_VALUE); | 2592 | emac_write(EMAC_TXUNDERRUN, stats_clear_mask); |
2581 | 2593 | ||
2582 | return &priv->net_dev_stats; | 2594 | return &priv->net_dev_stats; |
2583 | } | 2595 | } |