From e2db25aebe59997a31ff5d99c7e90879a9aa5efc Mon Sep 17 00:00:00 2001 From: Rostislav Lisovy Date: Wed, 14 Dec 2011 15:52:42 +0100 Subject: [PATCH] sllin: Updating of Error counters belonging to netdevice when an error occurs. --- sllin/README.txt | 9 +++++++++ sllin/sllin.c | 19 ++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/sllin/README.txt b/sllin/README.txt index 731a301..670cd6f 100644 --- a/sllin/README.txt +++ b/sllin/README.txt @@ -132,6 +132,15 @@ $ cangen sllin0 -r -I 8 -n 1 -L 0 sllin0 8 [0] remote request sllin0 2000 [0] +$ ip -s link show dev sllin0 +14: sllin0: mtu 16 qdisc pfifo_fast state UNKNOWN qlen 10 + link/can + RX: bytes packets errors dropped overrun mcast + 2 4 1 0 0 0 + TX: bytes packets errors dropped carrier collsns + 0 4 0 0 0 0 + + # ----- Configure frame cache ----- # Configure frame cache to answer on LIN ID = 8 diff --git a/sllin/sllin.c b/sllin/sllin.c index e075589..f10923e 100644 --- a/sllin/sllin.c +++ b/sllin/sllin.c @@ -230,8 +230,6 @@ static void sllin_send_canfr(struct sllin *sl, canid_t id, char *data, int len) sl->dev->stats.rx_packets++; sl->dev->stats.rx_bytes += cf.can_dlc; - - } /** @@ -459,6 +457,16 @@ static void sllin_receive_buf(struct tty_struct *tty, */ void sllin_report_error(struct sllin *sl, int err) { + switch (err) { + case LIN_ERR_CHECKSUM: + sl->dev->stats.rx_crc_errors++; + break; + + case LIN_ERR_RX_TIMEOUT: + sl->dev->stats.rx_errors++; + break; + } + sllin_send_canfr(sl, 0 | CAN_EFF_FLAG | (err & ~LIN_ID_MASK), NULL, 0); } @@ -905,7 +913,6 @@ int sllin_kwthread(void *ptr) if (sllin_rx_validate(sl) == -1) { pr_debug("sllin: RX validation failed.\n"); sllin_report_error(sl, LIN_ERR_CHECKSUM); - /* FIXME tx_stat.err++ */ } else { /* Send CAN non-RTR frame with data */ pr_debug("sllin: sending NON-RTR CAN" @@ -930,12 +937,6 @@ int sllin_kwthread(void *ptr) sl->lin_state = SLSTATE_IDLE; break; } - - - - - /* sl->dev->stats.tx_packets++; send frames statistic */ - /* netif_wake_queue(sl->dev); allow next Tx packet arrival */ } hrtimer_cancel(&sl->rx_timer); -- 2.39.2