diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2014-04-11 04:13:13 -0400 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2014-04-24 16:08:57 -0400 |
commit | 1da394d889b4110bda954813ef32601c06118376 (patch) | |
tree | 566c4cdd0941b15676968e57cd0a627ab8a86502 | |
parent | 097aec19689d8f2f76fd0c1becacf32801ae94c7 (diff) |
can: c_can: Always update error stats
If the allocation of the error skb fails, we still want to see the
error statistics.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rw-r--r-- | drivers/net/can/c_can/c_can.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index 9ef45b037a0c..6170e644426d 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c | |||
@@ -378,6 +378,9 @@ static int c_can_handle_lost_msg_obj(struct net_device *dev, | |||
378 | priv->write_reg(priv, C_CAN_IFACE(MSGCTRL_REG, iface), ctrl); | 378 | priv->write_reg(priv, C_CAN_IFACE(MSGCTRL_REG, iface), ctrl); |
379 | c_can_object_put(dev, iface, objno, IF_COMM_CONTROL); | 379 | c_can_object_put(dev, iface, objno, IF_COMM_CONTROL); |
380 | 380 | ||
381 | stats->rx_errors++; | ||
382 | stats->rx_over_errors++; | ||
383 | |||
381 | /* create an error msg */ | 384 | /* create an error msg */ |
382 | skb = alloc_can_err_skb(dev, &frame); | 385 | skb = alloc_can_err_skb(dev, &frame); |
383 | if (unlikely(!skb)) | 386 | if (unlikely(!skb)) |
@@ -385,8 +388,6 @@ static int c_can_handle_lost_msg_obj(struct net_device *dev, | |||
385 | 388 | ||
386 | frame->can_id |= CAN_ERR_CRTL; | 389 | frame->can_id |= CAN_ERR_CRTL; |
387 | frame->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; | 390 | frame->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; |
388 | stats->rx_errors++; | ||
389 | stats->rx_over_errors++; | ||
390 | 391 | ||
391 | netif_receive_skb(skb); | 392 | netif_receive_skb(skb); |
392 | return 1; | 393 | return 1; |
@@ -996,6 +997,10 @@ static int c_can_handle_bus_err(struct net_device *dev, | |||
996 | if (!(priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)) | 997 | if (!(priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)) |
997 | return 0; | 998 | return 0; |
998 | 999 | ||
1000 | /* common for all type of bus errors */ | ||
1001 | priv->can.can_stats.bus_error++; | ||
1002 | stats->rx_errors++; | ||
1003 | |||
999 | /* propagate the error condition to the CAN stack */ | 1004 | /* propagate the error condition to the CAN stack */ |
1000 | skb = alloc_can_err_skb(dev, &cf); | 1005 | skb = alloc_can_err_skb(dev, &cf); |
1001 | if (unlikely(!skb)) | 1006 | if (unlikely(!skb)) |
@@ -1005,10 +1010,6 @@ static int c_can_handle_bus_err(struct net_device *dev, | |||
1005 | * check for 'last error code' which tells us the | 1010 | * check for 'last error code' which tells us the |
1006 | * type of the last error to occur on the CAN bus | 1011 | * type of the last error to occur on the CAN bus |
1007 | */ | 1012 | */ |
1008 | |||
1009 | /* common for all type of bus errors */ | ||
1010 | priv->can.can_stats.bus_error++; | ||
1011 | stats->rx_errors++; | ||
1012 | cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; | 1013 | cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; |
1013 | cf->data[2] |= CAN_ERR_PROT_UNSPEC; | 1014 | cf->data[2] |= CAN_ERR_PROT_UNSPEC; |
1014 | 1015 | ||