diff options
author | Wolfgang Grandegger <wg@grandegger.com> | 2009-09-01 01:29:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-04 05:16:15 -0400 |
commit | 8935f57e68c40c6469efe03f996bfb6150e18c6b (patch) | |
tree | 2e9467085839fff453d7760bf2623bb2a4a02117 /drivers/net/can/sja1000/sja1000.c | |
parent | 39e3ab6fded4d7e66e01a878f0cae23ddd480c3b (diff) |
can: sja1000: fix network statistics update
The member "tx_bytes" of "struct net_device_stats" should be
incremented when the interrupt is done and an "arbitration
lost error" is a TX error and the statistics should be updated
accordingly.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/can/sja1000/sja1000.c')
-rw-r--r-- | drivers/net/can/sja1000/sja1000.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index fd7fa716a6ca..16d2ecd2a3b7 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c | |||
@@ -242,7 +242,6 @@ static netdev_tx_t sja1000_start_xmit(struct sk_buff *skb, | |||
242 | struct net_device *dev) | 242 | struct net_device *dev) |
243 | { | 243 | { |
244 | struct sja1000_priv *priv = netdev_priv(dev); | 244 | struct sja1000_priv *priv = netdev_priv(dev); |
245 | struct net_device_stats *stats = &dev->stats; | ||
246 | struct can_frame *cf = (struct can_frame *)skb->data; | 245 | struct can_frame *cf = (struct can_frame *)skb->data; |
247 | uint8_t fi; | 246 | uint8_t fi; |
248 | uint8_t dlc; | 247 | uint8_t dlc; |
@@ -276,7 +275,6 @@ static netdev_tx_t sja1000_start_xmit(struct sk_buff *skb, | |||
276 | for (i = 0; i < dlc; i++) | 275 | for (i = 0; i < dlc; i++) |
277 | priv->write_reg(priv, dreg++, cf->data[i]); | 276 | priv->write_reg(priv, dreg++, cf->data[i]); |
278 | 277 | ||
279 | stats->tx_bytes += dlc; | ||
280 | dev->trans_start = jiffies; | 278 | dev->trans_start = jiffies; |
281 | 279 | ||
282 | can_put_echo_skb(skb, dev, 0); | 280 | can_put_echo_skb(skb, dev, 0); |
@@ -427,7 +425,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) | |||
427 | dev_dbg(dev->dev.parent, "arbitration lost interrupt\n"); | 425 | dev_dbg(dev->dev.parent, "arbitration lost interrupt\n"); |
428 | alc = priv->read_reg(priv, REG_ALC); | 426 | alc = priv->read_reg(priv, REG_ALC); |
429 | priv->can.can_stats.arbitration_lost++; | 427 | priv->can.can_stats.arbitration_lost++; |
430 | stats->rx_errors++; | 428 | stats->tx_errors++; |
431 | cf->can_id |= CAN_ERR_LOSTARB; | 429 | cf->can_id |= CAN_ERR_LOSTARB; |
432 | cf->data[0] = alc & 0x1f; | 430 | cf->data[0] = alc & 0x1f; |
433 | } | 431 | } |
@@ -484,6 +482,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) | |||
484 | 482 | ||
485 | if (isrc & IRQ_TI) { | 483 | if (isrc & IRQ_TI) { |
486 | /* transmission complete interrupt */ | 484 | /* transmission complete interrupt */ |
485 | stats->tx_bytes += priv->read_reg(priv, REG_FI) & 0xf; | ||
487 | stats->tx_packets++; | 486 | stats->tx_packets++; |
488 | can_get_echo_skb(dev, 0); | 487 | can_get_echo_skb(dev, 0); |
489 | netif_wake_queue(dev); | 488 | netif_wake_queue(dev); |