Commit 8935f57e authored by Wolfgang Grandegger's avatar Wolfgang Grandegger Committed by David S. Miller

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: default avatarWolfgang Grandegger <wg@grandegger.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 39e3ab6f
...@@ -242,7 +242,6 @@ static netdev_tx_t sja1000_start_xmit(struct sk_buff *skb, ...@@ -242,7 +242,6 @@ static netdev_tx_t sja1000_start_xmit(struct sk_buff *skb,
struct net_device *dev) struct net_device *dev)
{ {
struct sja1000_priv *priv = netdev_priv(dev); struct sja1000_priv *priv = netdev_priv(dev);
struct net_device_stats *stats = &dev->stats;
struct can_frame *cf = (struct can_frame *)skb->data; struct can_frame *cf = (struct can_frame *)skb->data;
uint8_t fi; uint8_t fi;
uint8_t dlc; uint8_t dlc;
...@@ -276,7 +275,6 @@ static netdev_tx_t sja1000_start_xmit(struct sk_buff *skb, ...@@ -276,7 +275,6 @@ static netdev_tx_t sja1000_start_xmit(struct sk_buff *skb,
for (i = 0; i < dlc; i++) for (i = 0; i < dlc; i++)
priv->write_reg(priv, dreg++, cf->data[i]); priv->write_reg(priv, dreg++, cf->data[i]);
stats->tx_bytes += dlc;
dev->trans_start = jiffies; dev->trans_start = jiffies;
can_put_echo_skb(skb, dev, 0); 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,7 +425,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
dev_dbg(dev->dev.parent, "arbitration lost interrupt\n"); dev_dbg(dev->dev.parent, "arbitration lost interrupt\n");
alc = priv->read_reg(priv, REG_ALC); alc = priv->read_reg(priv, REG_ALC);
priv->can.can_stats.arbitration_lost++; priv->can.can_stats.arbitration_lost++;
stats->rx_errors++; stats->tx_errors++;
cf->can_id |= CAN_ERR_LOSTARB; cf->can_id |= CAN_ERR_LOSTARB;
cf->data[0] = alc & 0x1f; cf->data[0] = alc & 0x1f;
} }
...@@ -484,6 +482,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) ...@@ -484,6 +482,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
if (isrc & IRQ_TI) { if (isrc & IRQ_TI) {
/* transmission complete interrupt */ /* transmission complete interrupt */
stats->tx_bytes += priv->read_reg(priv, REG_FI) & 0xf;
stats->tx_packets++; stats->tx_packets++;
can_get_echo_skb(dev, 0); can_get_echo_skb(dev, 0);
netif_wake_queue(dev); netif_wake_queue(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment