]> rtime.felk.cvut.cz Git - linux-lin.git/commitdiff
sllin: Updating of Error counters belonging to netdevice when an error occurs.
authorRostislav Lisovy <lisovy@gmail.com>
Wed, 14 Dec 2011 14:52:42 +0000 (15:52 +0100)
committerRostislav Lisovy <lisovy@gmail.com>
Wed, 14 Dec 2011 14:52:42 +0000 (15:52 +0100)
sllin/README.txt
sllin/sllin.c

index 731a301980f53723fc8bf2b7218b246dc4bec722..670cd6fb308ef0332760e7171c170346acf2ad2e 100644 (file)
@@ -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: <NOARP,UP,LOWER_UP> 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
index e07558994abde83283d66126ce0dc2902d390c3b..f10923e53816fd9e2d8d0aa3be0ce902070f0f97 100644 (file)
@@ -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);